[sage-support] Re: installation under snow leopard

2010-10-23 Thread Ferren
OK, distinct signs of progress. The root password remains mysterious; the login password is under control; and the .sage directory now seems pretty accessible: dispo-82-248-128-135:~ ferrenmacintyre$ cd .sage/ dispo-82-248-128-135:.sage ferrenmacintyre$ ls -l total 0 drwxrwxr-x 2 root admin

[sage-support] Python or Sage behavior?

2010-10-23 Thread Rolandb
Hi, look at the following simple routine. def why(): test=((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if gcd(k1,k2)==1) print [t for t in test] print [t for t in test] return why() [(1, 2), (1, 3), (2, 3)] [] It seems that test can only be used once. The Python

[sage-support] Re: Python or Sage behavior?

2010-10-23 Thread Nils Bruin
On Oct 23, 12:27 am, Rolandb rola...@planet.nl wrote: Hi, look at the following simple routine. def why():     test=((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if gcd(k1,k2)==1)     print [t for t in test]     print [t for t in test]     return why() [(1, 2), (1, 3), (2,

Re: [sage-support] Python or Sage behavior?

2010-10-23 Thread flamingspinach
Hello, ((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if gcd(k1,k2)==1) is a generator expression that returns an iterator. Using list comprehension on the iterator (i.e. [t for t in test]) advances it until it is exhausted, after which the list comprehension returns all the results.

Re: [sage-support] Creating large matrix hangs

2010-10-23 Thread Robert Bradshaw
On Fri, Oct 22, 2010 at 9:34 PM, Cary Cherng cche...@gmail.com wrote: I have a sage script that ultimately creates a python list called MMv of length 35354. Each element is a list of length 55. This is in effect a 35354 by 55 matrix. Print statements show that when I run my script with load

[sage-support] Re: installation under snow leopard

2010-10-23 Thread Ferren
Success. I logged in under my other name, and sage compiled. No idea why, but I'm happy. Thanks for the hand-holding: I learned a bit more about Unix. Now to explore Sage. --Ferren On Oct 23, 8:46 am, Ferren ferren.macint...@gmail.com wrote: OK, distinct signs of progress. The root password

[sage-support] Re: Creating large matrix hangs

2010-10-23 Thread Simon King
Hi Robert! On 23 Okt., 10:18, Robert Bradshaw rober...@math.washington.edu wrote: Can you run top() and see (1) how much CPU it's using and (2) how much memory it's using (compared to your free memory). I doubt that memory is the problem. The following is on sage.math (thus, with plenty of

[sage-support] Re: Creating large matrix hangs

2010-10-23 Thread Simon King
Hi! On 23 Okt., 11:59, Simon King simon.k...@nuigalway.ie wrote: So, one should create an empty matrix and then insert the elements row by row. It it also more efficient on a smaller skale (and does the right thing): sage: MS = MatrixSpace(ZZ,100,50) sage: L = [[ZZ.random_element() for _ in

[sage-support] Re: Creating large matrix hangs

2010-10-23 Thread Yann
On Oct 23, 12:20 pm, Simon King simon.k...@nuigalway.ie wrote: Hi! On 23 Okt., 11:59, Simon King simon.k...@nuigalway.ie wrote: So, one should create an empty matrix and then insert the elements row by row. It it also more efficient on a smaller skale (and does the right thing):

[sage-support] Re: Creating large matrix hangs

2010-10-23 Thread Yann
In the matrix constructor (matrix in sage/matrix/constructor.py): entries = sum([list(v) for v in args[0]], [])    --- this is bad (quadratic in the length of argv[0] which is the number of rows here) and to be complete, this could be replaced by: entries = [] for v in args[0]:

[sage-support] Re: Creating large matrix hangs

2010-10-23 Thread Simon King
Hi Yann! On 23 Okt., 13:32, Yann yannlaiglecha...@gmail.com wrote: ... In the matrix constructor (matrix in sage/matrix/constructor.py): entries = sum([list(v) for v in args[0]], [])    --- this is bad (quadratic in the length of argv[0] which is the number of rows here) I guess this line

[sage-support] Re: Creating large matrix hangs

2010-10-23 Thread Yann
this is now ticket #10158 Yann -- 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 URL:

[sage-support] Re: Creating large matrix hangs

2010-10-23 Thread Simon King
On 23 Okt., 14:15, Yann yannlaiglecha...@gmail.com wrote: this is now ticket #10158 Thanks! Simon -- 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

Re: [sage-support] Python or Sage behavior? - List - tuple and iterator

2010-10-23 Thread Francois Maltey
Rolandb wrote : test=((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if gcd(k1,k2)==1) print [t for t in test] print [t for t in test] [(1, 2), (1, 3), (2, 3)] [] I begun to confuse lists L with [...] we can free change : one change one term by L[1]=123, and change the length by

[sage-support] minimum polynomial

2010-10-23 Thread andrew ewart
If i have an element alpha=3^(1/3)+(7^(1/2)*2^(1/4)) and an ideal I=a^3-3, b^2-7,c^4-2, alpha-(a+b*c) how do i show the minimum polynomial of alpha lies in the ideal I then use it to construct the minumum polynomial of alpha So far I have: P.a,b,c = PolynomialRing(QQ)

[sage-support] polynomial constructor from roots

2010-10-23 Thread andrew ewart
if alpha is a root of x^2+a_1*x+a_0 and beta is a root of x^2+b_1*x +b_0 (both polynomials r in QQ), then how do i construct code such that it can tell me the minimum polynomials of the following roots alpha+beta and alpha*beta -- To post to this group, send email to

[sage-support] Re: minimum polynomial

2010-10-23 Thread Yann
On 23 oct, 21:01, andrew ewart aewartma...@googlemail.com wrote: If i have an element alpha=3^(1/3)+(7^(1/2)*2^(1/4)) and an ideal I=a^3-3, b^2-7,c^4-2, alpha-(a+b*c) how do i show the minimum polynomial of alpha lies in the ideal I then use it to construct the minumum polynomial of alpha

[sage-support] Finding cube roots in terms of parameters

2010-10-23 Thread vasu
Hi all Suppose I have an positive integer parameter 't', and a polynomial Delta(t) , which is a polynomial in 't' with coefficients being integers. Assume we also know that Delta(t) 0. There is another polynomial with integer coefficients , say F(t). Consider an expression [x(t)]^3 = F(t) + i *

[sage-support] Casting from type rational functions to type polynomials

2010-10-23 Thread Cary Cherng
R.g17,g19,g27,g28,g38,g39,g47,g49,g57,g58,g68,g69 = PolynomialRing(QQ) Eventually I compute a polynomial p with something like p = p1 / q.determinant() Sage gives p with type fraction field. How do I cast p back to the polynomial ring so I can call degree() on it? -- To post to this group,

[sage-support] Re: Casting from type rational functions to type polynomials

2010-10-23 Thread John H Palmieri
On Oct 23, 7:20 pm, Cary Cherng cche...@gmail.com wrote: R.g17,g19,g27,g28,g38,g39,g47,g49,g57,g58,g68,g69 = PolynomialRing(QQ) Eventually I compute a polynomial p with something like p = p1 / q.determinant() Sage gives p with type fraction field. How do I cast p back to the polynomial

[sage-support] Re: Python or Sage behavior? - List - tuple and iterator

2010-10-23 Thread Jason Grout
A few little corrections or explanations inline below... On 10/23/10 8:34 AM, Francois Maltey wrote: Rolandb wrote : test=((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if gcd(k1,k2)==1) print [t for t in test] print [t for t in test] [(1, 2), (1, 3), (2, 3)] [] I begun to confuse

[sage-support] Re: Python or Sage behavior? - List - tuple and iterator

2010-10-23 Thread Jason Grout
A correction to my corrections inline below! On 10/23/10 9:56 PM, Jason Grout wrote: A few little corrections or explanations inline below... On 10/23/10 8:34 AM, Francois Maltey wrote: Rolandb wrote : test=((k2,k1) for k1 in xrange(2,4) for k2 in xrange(1,k1) if gcd(k1,k2)==1) print [t for

Re: [sage-support] Re: Python or Sage behavior? - List - tuple and iterator

2010-10-23 Thread Robert Bradshaw
On Sat, Oct 23, 2010 at 8:07 PM, Jason Grout jason-s...@creativetrax.com wrote: A correction to my corrections inline below! On 10/23/10 9:56 PM, Jason Grout wrote: A few little corrections or explanations inline below... On 10/23/10 8:34 AM, Francois Maltey wrote: Rolandb wrote :

[sage-support] Re: Python or Sage behavior? - List - tuple and iterator

2010-10-23 Thread Jason Grout
On 10/23/10 10:20 PM, Robert Bradshaw wrote: In most cases, it's really the comma (not the parentheses) that creates the tuple. sage: a = 123, sage: a (123,) The parentheses are often needed for grouping purposes though. Aha. That agrees with

[sage-support] Re: Casting from type rational functions to type polynomials

2010-10-23 Thread Cary Cherng
That worked. On Oct 23, 7:41 pm, John H Palmieri jhpalmier...@gmail.com wrote: On Oct 23, 7:20 pm, Cary Cherng cche...@gmail.com wrote: R.g17,g19,g27,g28,g38,g39,g47,g49,g57,g58,g68,g69 = PolynomialRing(QQ) Eventually I compute a polynomial p with something like p = p1 /