[sage-support] Re: How do I create a matrix whose elements are functions of the row & column indices?

2008-12-11 Thread Robert Bradshaw

On Dec 10, 2008, at 4:23 PM, Alasdair wrote:

> Thanks - I didn't know (being a COMPLETE newbie) about the "range"
> command.  Where in the documentation would I find this? - I've had a
> bit of a search and couldn't find it.

Python both the language that much of Sage is written in, and the  
user interface to Sage, so I would recommend keeping a Python  
resource handy for basic stuff like this. For example, http:// 
docs.python.org/ and http://www.diveintopython.org/ are both pretty  
good.

Note that Sage preparses things a bit to make it a nicer math  
language, so 2^3 becomes exponentiation (instead of xor) and 1/3 is  
the rational number 1/3, not 0 or 0.333 as it is in pure Python.

- Robert
  

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Spreading Sage

2008-12-11 Thread Benjamin Otto

Hi everyone,

i am currently supporting a university class (mostly for future teachers) in 
germany in elementary number theory. I think the students really like using 
sage, but  we had a rough start getting to install and start using sage on 
their windows boxes.

I think you could greatly improve the number of people using sage, if the 
install-process on windows were easier.
Maybe the VMware company is interested in developing a modified package of 
their VMwareplayer including sage as a killer app? I imagine after the 
install of this you just have to klick on a desktop-icon, some banner comes 
up telling you "powerd by vmware" (so vmware gets credit ;)) and the browser 
just starts with the sage-gui...

Do the offical sage developer like this idea? Will they ask Vmware if thats in 
a way possible?

bye,
Benjamin

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Spreading Sage

2008-12-11 Thread Harald Schilly

On Dec 11, 12:30 pm, Benjamin Otto <[EMAIL PROTECTED]> wrote:

> I think you could greatly improve the number of people using sage, if the
> install-process on windows were easier.

Hi, we are aware of that but it's not that easy ;)
Instead of vmware, there is also the possiblity (just a test) to run
it with andlinux.org:
http://picasaweb.google.com/wstein/SageAndLinux

Hopefully, some day there will be a .msi package for easy distribution
across the network and everything works out of the box ;)

h
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Is there a utility to compute the value of the error function of a complex number?

2008-12-11 Thread Doug Bradshaw

Thanks!

On Dec 9, 5:17 pm, Jason Grout <[EMAIL PROTECTED]> wrote:
> Doug Bradshaw wrote:
> > Okay, here's the story:  I wanted to plot a Fourier transform of a
> > Gaussian that is truncated (mulitplied by unit stepfunction).  Using
> > "integral", I got an answer that looked nice, but contained anerror
> >functionwith an imaginary argument.  Because thaterrorfunction
> > couldn't be evaluated, I couldn't plot.  So, that brings up the
> > question: is there a nice way to evaluate theerrorfunctionof an
> > imaginary number (or more generally a complex number) in Sage?
>
> > sage: erf(1)
> > erf(1)
> > sage: erf(1).n()
> > 0.842700792949715
> > sage: erf(I)
> > erf(I)
> > sage: erf(I).n()
> > ---
> > TypeError                                 Traceback (most recent call
> > last)
>
> I'm not sure about the Sage erf, but you could also use the scipy erf:
>
> sage: import scipy.special
> sage: scipy.special.erf(complex(I))
> 1.6504257587975433j
>
> You could also do scipy.special. (press tab) to see the other
> variants of erf that scipy has.
>
> Note that you need to do complex(I) or the equivalent, since scipy does
> not understand Sage complex numbers.
>
> Seehttp://docs.scipy.org/doc/scipy/reference/special.html#error-function...
>
> Jason
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] python 3.0 (py3k or python 3000 too)

2008-12-11 Thread Owen

What are our plans for py3k?

I ask because there are some youth education efforts moving to 3.0 so
that the kids don't get introduced to "legacy" concepts!  Here's one:
http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/

Thanks,
   -- Owen


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: python 3.0 (py3k or python 3000 too)

2008-12-11 Thread mabshoff



On Dec 11, 10:10 am, Owen <[EMAIL PROTECTED]> wrote:

Hi Owen,

> What are our plans for py3k?

This has been discussed twice in the last couple weeks, so the answer
is "wait and see". We will first upgrade to Python 2.6 once numpy
supports it (roughly January 2009 unless something goes wrong) and
then sooner or later go to 3.0. But to do that there need to be clear
benefits and I would expect that to easily take us six months or more
to switch. This will also likely depend on numpy working with python
3.0.

> I ask because there are some youth education efforts moving to 3.0 so
> that the kids don't get introduced to "legacy" concepts!  Here's one:
>    http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/
>
> Thanks,
>    -- Owen

Cheers,

Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Adjoint of matrix over a ring?

2008-12-11 Thread Alasdair

Suppose I create a matrix over the ring of integers mod 10:

M=random_matrix(IntegerModRing(10),3,3)

Now the adjoint certainly exists, but M.adjoint() isn't as yet
implemented over general rings - only over ZZ or QQ.  How can I use,
say, Maxima or Pari within Sage to compute the adjoint of M?

Thanks,
Alasdair
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Adjoint of matrix over a ring?

2008-12-11 Thread William Stein

On Thu, Dec 11, 2008 at 2:52 PM, Alasdair  wrote:
>
> Suppose I create a matrix over the ring of integers mod 10:
>
> M=random_matrix(IntegerModRing(10),3,3)
>
> Now the adjoint certainly exists, but M.adjoint() isn't as yet
> implemented over general rings - only over ZZ or QQ.  How can I use,
> say, Maxima or Pari within Sage to compute the adjoint of M?

You can do it as illustrated below.  However, note that for a random
input matrix it does not work in PARI (as you seem to think it
should), as illustrated below:

sage: M=random_matrix(IntegerModRing(10),3,3)
sage: b = pari(M)
sage: b.matadjoint()
---
PariError Traceback (most recent call last)

CODE:
sage[2]=matadjoint(sage[1]);
GP/PARI ERROR:
  *** matadjoint: impossible inverse modulo: Mod(8, 10).

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Adjoint of matrix over a ring?

2008-12-11 Thread Craig Citro

> M=random_matrix(IntegerModRing(10),3,3)
>
> Now the adjoint certainly exists, but M.adjoint() isn't as yet
> implemented over general rings - only over ZZ or QQ.  How can I use,
> say, Maxima or Pari within Sage to compute the adjoint of M?
>

It's pretty friendly to use Pari to do this ... in general, given any
sage object a, you can try pari(a) to convert it to Pari.

In this example, it works fine (though the pari output isn't the most
pleasant to read):

sage: M = random_matrix(IntegerModRing(10),3,3)

sage: Mp = pari(M)

sage: M

[4 2 0]
[5 4 8]
[9 6 2]

sage: Mp
[Mod(4, 10), Mod(2, 10), Mod(0, 10); Mod(5, 10), Mod(4, 10), Mod(8,
10); Mod(9, 10), Mod(6, 10), Mod(2, 10)]

Then you can call Mp.matadjoint() to get the adjoint. However, in this
case, Pari fails to find the adjoint:

sage: Mp.matadjoint()
---
PariError Traceback (most recent call last)

/Users/craigcitro/.sage/temp/sharma.local/8072/_Users_craigcitro__sage_init_sage_0.py
in ()
> 1
  2
  3
  4
  5

/sage/local/lib/python2.5/site-packages/sage/libs/pari/gen.so in
sage.libs.pari.gen._pari_trap (sage/libs/pari/gen.c:38577)()
   8048
   8049
-> 8050
   8051
   8052

PariError: impossible inverse modulo:  (36)

This is actually Pari behaving badly, not sage -- doing the same thing
in a GP session gets the same error. Apparently Pari can't find the
determinant of non-invertible square matrices of size at least 3x3
(???). I'll try to look at this and submit a bug report soon -- or you
could beat me to it. :)

In any event, say it worked (so I'll use 2x2 as an example). You
*should* be able to just call M.parent()(Mp.matadjoint()), but that
currently hits an error. However, the pari object Mp.matadjoint() has
a _sage_ method that knows how to convert back to sage. So this works:

sage: m = random_matrix(Integers(10),2,2) ; m
[0 9]
[3 5]
sage: mp = pari(m)
sage: mp.matadjoint()
[Mod(5, 10), Mod(1, 10); Mod(7, 10), Mod(0, 10)]
sage: mp.matadjoint()._sage_()
[5 1]
[7 0]
sage: pari(m).matadjoint()._sage_()
[5 1]
[7 0]

As you point out at the beginning, though, we really should have our
own native adjoint function. Here's a one-liner:

sage: M = random_matrix(Integers(10),3,3) ; M
[9 7 5]
[2 9 5]
[7 8 8]
sage: M.parent()([ (-1)^(i+j)*M.matrix_from_rows_and_columns([x for x
in range(M.nrows()) if x != i], [y for y in range(M.ncols()) if y !=
j]).det() for i in range(M.nrows()) for j in range(M.nrows())
]).transpose()
[2 4 0]
[9 7 5]
[3 7 7]

That function is terrible in a lot of ways -- but if you need
something right now, it works. :)

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Adjoint of matrix over a ring?

2008-12-11 Thread Alasdair

Actually, this seems to work (using Maxima):

M=random_matrix(IntegerModRing(10),3,3)
MM=maxima(M)
MA=matrix(IntegerModRing(10),MM.adjoint())

However, MA refuses to be typeset properly in the notebook - I
consistently get LaTeX code, rather than a nicely typeset matrix.

It would be nice to have a built in adjoint...

Thanks,
Alasdair

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Modularity of sage?

2008-12-11 Thread Alasdair

I'd like to install Sage on a laptop with not much disk space left on
it.  Now, I already have Maxima, Axiom, Pari/GP, and Python; is it
possible to just install some sort of "core" Sage from source code,
and still have the interfaces to the other CAS's?

Thanks,
Alasdair
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Modularity of sage?

2008-12-11 Thread David Joyner

Hi Alasdair:
I don't know the answer but I think it would be helpful to describe
(a) how much disk space you have,
(b) if there is a reason why you cannot delete maxima and
python (you will get them with Sage and you can run them
using "sage -python" and "sage -maxima").
- David


On Thu, Dec 11, 2008 at 8:52 PM, Alasdair  wrote:
>
> I'd like to install Sage on a laptop with not much disk space left on
> it.  Now, I already have Maxima, Axiom, Pari/GP, and Python; is it
> possible to just install some sort of "core" Sage from source code,
> and still have the interfaces to the other CAS's?
>
> Thanks,
> Alasdair
> >
>

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Modularity of sage?

2008-12-11 Thread William Stein

On Thu, Dec 11, 2008 at 5:52 PM, Alasdair  wrote:
>
> I'd like to install Sage on a laptop with not much disk space left on
> it.  Now, I already have Maxima, Axiom, Pari/GP, and Python; is it
> possible to just install some sort of "core" Sage from source code,
> and still have the interfaces to the other CAS's?

No, unfortunately that isn't possible.

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Modularity of sage?

2008-12-11 Thread chu-ching huang

In my case, I use some python packages that are not included in Sage.
It is very to solve the problem to enhance the python computing over
Sage: just create link from system to sage directory, This is possible
to reduce disk space a little. And it is possible to upgrade
additional packages and Sage partly. I also use such method to extend
Maxima since some function needed in my system. Hope this can help.

cch


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Modularity of sage?

2008-12-11 Thread mabshoff



On Dec 11, 7:41 pm, chu-ching huang  wrote:
> In my case, I use some python packages that are not included in Sage.
> It is very to solve the problem to enhance the python computing over
> Sage: just create link from system to sage directory, This is possible
> to reduce disk space a little. And it is possible to upgrade
> additional packages and Sage partly. I also use such method to extend
> Maxima since some function needed in my system. Hope this can help.
>
> cch

Using Sage in a more modular fashion is possible, but you really have
to know what you are doing. Many of the components in Sage contain bug
fixes from upstream, so using system components will expose you to
subtle bugs. The only way to be reasonably sure that things more or
less work as expected is to see if your Sage passes "make check", but
even that is no guarantee that Sage will "just work".

Cheers,

Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---