[sage-support] Cayley Hamilton

2008-11-17 Thread Martin Rubey
I tried to demonstrate Cayley Hamilton in Sage, but failed. Here is what I tries: sage: f = function('f') sage: m = matrix([[f(i,j) for j in range(2)] for i in range(2)]) sage: p=SR[x](m.characteristic_polynomial('x')) sage: p.subs(x=m) [(f(0, 0) - x)*(f(1, 1) - x) - f(0, 1)*f(1, 0) 0] [

[sage-support] Re: Cayley Hamilton

2008-11-17 Thread Mike Hansen
I would do something like this: sage: m = matrix([[var('x%s%s'%(i,j)) for j in range(2)] for i in range(2)]); m [x00 x01] [x10 x11] sage: m.characteristic_polynomial().polynomial(QQ).subs(x=m) [0 0] [0 0] --Mike --~--~-~--~~~---~--~~ To post to this group, send e

[sage-support] Re: Cayley Hamilton

2008-11-17 Thread Jason Grout
Martin Rubey wrote: > I tried to demonstrate Cayley Hamilton in Sage, but failed. Here is what I > tries: > Alternatively, you could do everything in polynomial rings: sage: R.=QQ[] sage: m=matrix(R, 2, [x1,x2,x3,x4]) sage: m [x1 x2] [x3 x4] sage: m.charpoly() x^2 + (-x1 - x4)*x - x2*x3 + x1*

[sage-support] Re: Cayley Hamilton

2008-11-17 Thread Martin Rubey
Jason Grout <[EMAIL PROTECTED]> writes: > Martin Rubey wrote: > > I tried to demonstrate Cayley Hamilton in Sage, but failed. Here is what I > > tries: > > > > sage: f = function('f') > > sage: m = matrix([[f(i,j) for j in range(2)] for i in range(2)]) > > sage: p=SR[x](m.characteristic_polynom

[sage-support] Re: Cayley Hamilton

2008-11-17 Thread Jason Grout
Martin Rubey wrote: > I tried to demonstrate Cayley Hamilton in Sage, but failed. Here is what I > tries: > > sage: f = function('f') > sage: m = matrix([[f(i,j) for j in range(2)] for i in range(2)]) > sage: p=SR[x](m.characteristic_polynomial('x')) > sage: p.subs(x=m) > > [(f(0, 0) - x)*(f(1,

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Stan Schymanski
A week older and still not smarter... Sorry for the noise, but I am still trying to find a way of getting useful latex output for equations that contain decimal numbers. It seems that the previous posts passed below the radars of those that might know the answer, so I am trying to push it to the s

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Marshall Hampton
There are a number of interact examples on the wiki (such as the Gram- Schmidt one at http://wiki.sagemath.org/interact/linear_algebra) that work around this problem by casting to a field of low precision, for example doing something like latex(RealField(8)(0.6)) produces "0.60". Hope that help

[sage-support] why does simplify_full() add a factor of 1.0?

2008-11-17 Thread Stan Schymanski
Dear all, I want to use simplify and pretty_print (or show or latex) to display pretty equations. However, in some cases, simplify_full() adds a factor of 1.0 to the equation, which prints as an ugly 1.0 in latex. Is this a bug? Example: vp = (exp(17.27*x/(x+237.3))); pretty_print(

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Mike Hansen
On Mon, Nov 17, 2008 at 7:12 AM, Marshall Hampton <[EMAIL PROTECTED]> wrote: > > There are a number of interact examples on the wiki (such as the Gram- > Schmidt one at http://wiki.sagemath.org/interact/linear_algebra) that > work around this problem by casting to a field of low precision, for > e

[sage-support] Re: Cayley Hamilton

2008-11-17 Thread Martin Rubey
Jason Grout <[EMAIL PROTECTED]> writes: > > Why is your coefficients different from mine? > > > I specifically asked for the coefficient of "x". You just asked for the > coefficients, but didn't specify what variable was the variable of your > polynomial. OK, I think I understand now: Sage

[sage-support] Re: Cayley Hamilton

2008-11-17 Thread Jason Grout
Martin Rubey wrote: > Jason Grout <[EMAIL PROTECTED]> writes: > >> Martin Rubey wrote: >>> I tried to demonstrate Cayley Hamilton in Sage, but failed. Here is what I >>> tries: >>> >>> sage: f = function('f') >>> sage: m = matrix([[f(i,j) for j in range(2)] for i in range(2)]) >>> sage: p=SR[x](

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Mike Hansen
If a is your real number, and then a._latex_?? will point you in the direction that you need to go. It leads to the _latex_ function for which there really isn't anything deep going on. If all you care about is truncating zeros, then following changes will do: diff -r 07a824fa8f2b sage/rings/re

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Jason Grout
Marshall Hampton wrote: > There are a number of interact examples on the wiki (such as the Gram- > Schmidt one at http://wiki.sagemath.org/interact/linear_algebra) that > work around this problem by casting to a field of low precision, for > example doing something like > > latex(RealField(8)(0.6

[sage-support] Re: Cayley Hamilton

2008-11-17 Thread Jason Grout
Martin Rubey wrote: > Jason Grout <[EMAIL PROTECTED]> writes: > >>> Why is your coefficients different from mine? >> >> I specifically asked for the coefficient of "x". You just asked for the >> coefficients, but didn't specify what variable was the variable of your >> polynomial. > > OK, I t

[sage-support] polymake

2008-11-17 Thread chirag.lakh...@gmail.com
I am confused about the polymake module. Does this module allow you to do everything in polymake or just the particular functions listed in the sage reference manual. Thanks. --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com

[sage-support] problem with for

2008-11-17 Thread Martin Mereb
I'm trying to run the following: sage: n=3; q=7; G=SL(n,q) sage: for a in G: : print a : it just got stuck there, nothing shows up (for a looong while) this is Sage version 3.1.1 and if I try the same with q=4 it works (but it takes some time to start) any ideas? tinch --~--~---

[sage-support] Re: problem with for

2008-11-17 Thread Justin C. Walker
On Nov 17, 2008, at 9:34 AM, Martin Mereb wrote: > > I'm trying to run the following: > > sage: n=3; q=7; G=SL(n,q) > sage: for a in G: > : print a > : > > it just got stuck there, nothing shows up (for a looong while) > this is Sage version 3.1.1 > > and if I try the same with q=4 i

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Stan Schymanski
Dear Marshall, Thanks a lot for looking into this. I tried similar approaches as well, and so did the original poster. However, as soon as you introduce a symbolic variable into the equation, latex does weird things such as: latex(RealField(8)(0.6)*x) produces "{0.6016000 x}" Does thi

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Robert Bradshaw
Any decimal number that goes into maxima turns into a 53-bit floating point number (at least by default), which then turns into a 53 bit MPFR coming out. The reason all the trailing 0's are exposed is to show how much precision is known. Maxima (as far as I know) doesn't have the concept o

[sage-support] Question about doc tests

2008-11-17 Thread Simon King
Dear Team, I have a couple of .pyx files and (sometimes trying to be a good boy) I provided long doc strings with lots of doc tests. However, sage -t foo.pyx fails by raising errors on *all* tests that involve any function from 'foo.pyx'. First attempt: Plainly use the function 'bar' from

[sage-support] Re: Save Latex from Sage into file?

2008-11-17 Thread Christoph Bichler
I'm sorry I didn't ask more precisely.. Yes, that's what I actually meant to ask. I want to save e.g. latex(x) to a .tex file. I'm using Sage on Windows, with the VMware image. Thanks for the reply! Kinds regards, Christoph On 16 Nov., 19:54, "William Stein" <[EMAIL PROTECTED]> wrote: > On Sun,

[sage-support] Re: Save Latex from Sage into file?

2008-11-17 Thread William Stein
On Mon, Nov 17, 2008 at 11:28 AM, Christoph Bichler <[EMAIL PROTECTED]> wrote: > > I'm sorry I didn't ask more precisely.. > Yes, that's what I actually meant to ask. > I want to save e.g. latex(x) to a .tex file. > I'm using Sage on Windows, with the VMware image. Here's an example (without the

[sage-support] Re: problem with for

2008-11-17 Thread Martin Mereb
I see I expressed myself wrong (I meant the problem was in the "for" line) so what's going on is that gap is attempting to built first the whole list and that is taking way too much time (right?) are there any iterator that avoids that amount of memory and take the elements "on the fly", like xran

[sage-support] Re: problem with for

2008-11-17 Thread David Joyner
On Mon, Nov 17, 2008 at 3:24 PM, Martin Mereb <[EMAIL PROTECTED]> wrote: > > I see I expressed myself wrong > (I meant the problem was in the "for" line) > so what's going on is that gap is attempting to built first the whole > list and that is taking way too much time (right?) > are there any ite

[sage-support] Re: problem with for

2008-11-17 Thread Martin Mereb
ok, thanks! On Mon, Nov 17, 2008 at 2:39 PM, David Joyner <[EMAIL PROTECTED]> wrote: > > On Mon, Nov 17, 2008 at 3:24 PM, Martin Mereb <[EMAIL PROTECTED]> wrote: >> >> I see I expressed myself wrong >> (I meant the problem was in the "for" line) >> so what's going on is that gap is attempting to

[sage-support] Re: polymake

2008-11-17 Thread Marshall Hampton
The current interface to polymake is pretty minimal, a lot more could be done to improve it. You need to install the polymake optional spkg for it to work - this installs a full-fledged version of polymake that you could use on its own as well. Last time I checked the spkg was broken, but in a m

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Marshall Hampton
Its probably not necessary to note this, but on the slim chance it is I'll point out that the regular expression module, re, is a standard python module that is not imported by default so you have to do sage: import re before Robert's solution. -mh On Nov 17, 1:05 pm, Robert Bradshaw <[EMAIL P

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Stan Schymanski
Dear Mike, Thanks a lot for that, this looks very promising. However, after making the suggested change, the behaviour of latex() did not change. Do I need to restart sage for the changes to take effect? dummy._latex_?? reflects the changes made, but the 0s are still there when I latex(dummy). d

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Mike Hansen
Hello, On Mon, Nov 17, 2008 at 11:11 PM, Stan Schymanski <[EMAIL PROTECTED]> wrote: > > Dear Mike, > > Thanks a lot for that, this looks very promising. However, after > making the suggested change, the behaviour of latex() did not change. > Do I need to restart sage for the changes to take effec

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Stan Schymanski
Hi Robert, Thanks, this explains what is going on. Would there be a way of including the regular expressions procedure in the show() command? The output of the line you proposed is a string, which doesn't show well in show(). :) Thanks again, Stan On Nov 17, 8:05 pm, Robert Bradshaw <[EMAIL PRO

[sage-support] Re: latex output for real numbers without zeros at the end

2008-11-17 Thread Stan Schymanski
Hi Mike, This is great, it does exactly what I wanted. Thanks a lot! Are there any potentially undesired side-effects of the changes in real_mpfr.pyx or could this fix be included in future versions of sage? Stan On Nov 18, 8:14 am, "Mike Hansen" <[EMAIL PROTECTED]> wrote: > Hello, > > On Mon,