[sage-support] Project Euler
Hi, To learn SAGE takes a while, and good exercises are scarce. It was mentioned before, but the site http://projecteuler.net/ is interesting. The idea is to solve relatively simple mathematical problems and the level is going up slowly. For instance group operations, read/write to a file, speed are topics you will encounter. Until now I solved 38 problems. Two questions arise: 1. Suppose you have two functions: SLOW and FAST which return the boolean True or False. Is there a difference in speed between: a. If SLOW and FAST: …. b. If FAST and SLOW: …. The second option seems faster because only SLOW is executed if FAST==True. Or does the compiler checks this? 2. Is there a more elegant way for: for k1 in range(-2,3): for k2 in range(-2,3): for k3 in range(-2,3): for k4 in range(-2,3): for k5 in range(-2,3): for k6 in range(-2,3): for k7 in range(-2,3): ? Roland --~--~-~--~~~---~--~~ 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] 0.00 correct?
Hi, Sage: A = matrix([ [-1.0, -1.0, 0.0, 1.0], [1.0, -1.0, -1.0, -2.0] ]) Sage: A.n(2) [-1.0 -1.0 0.00 1.0] [ 1.0 -1.0 -1.0 -2.0] Roland --~--~-~--~~~---~--~~ 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] PSLQ available?
Hi, Are algorithms like PSLQ available? If yes, please give a simple example so that I fully understand the commands. Thanks in advance! Roland --~--~-~--~~~---~--~~ 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] Memory Error?
Hi, I received first a MemoryError, and later on Sage reported: /usr/local/sage/local/bin/sage-sage: line 358: 10172 Killed python $@ {{{id=59| uitkomst1=[] uitkomst2=[] eind=int((10^9+2)/(2*sqrt(3))) print eind for y in srange(1,eind): test1=is_square(3*y^2+1,True) test2=is_square(48*y^2+1,True) if test1[0] and test1[1]%3==2: uitkomst1.append((y,(2*test1[1]-1)/3)) if test2[0] and test2[1]%3==1: uitkomst2.append((y,(2*test2[1]+1)/3)) print uitkomst1 een=sum([3*x-1 for (y,x) in uitkomst1 if 3*x-110^9]) print uitkomst2 twee=sum([3*x+1 for (y,x) in uitkomst2 if 3*x+110^9]) print een+twee /// }}} If you replace 10^9 with 10^6, the above listing works properly. Maybe I made a mistake? Rolandb --~--~-~--~~~---~--~~ 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: Memory Error?
Tnx! I learned useful stuff ... On 31 jan, 20:52, William Stein wst...@gmail.com wrote: On Sat, Jan 31, 2009 at 11:40 AM, William Stein wst...@gmail.com wrote: On Sat, Jan 31, 2009 at 11:26 AM, mabshoff michael.absh...@mathematik.uni-dortmund.de wrote: On Jan 31, 11:17 am, William Stein wst...@gmail.com wrote: On Sat, Jan 31, 2009 at 11:15 AM, Rolandb rola...@planet.nl wrote: Hi, I received first a MemoryError, and later on Sage reported: That means that Sage ran out of memory. It's not a bug -- it's just a limitation of your computer. srange() builds a list in memory, so using an iterator will make that code use less memory. Good idea. His an iterator version of the code: uitkomst1=[] uitkomst2=[] eind=int((10^9+2)/(2*sqrt(3))) print eind for y in (1..eind): test1=is_square(3*y^2+1,True) test2=is_square(48*y^2+1,True) if test1[0] and test1[1]%3==2: uitkomst1.append((y,(2*test1[1]-1)/3)) if test2[0] and test2[1]%3==1: uitkomst2.append((y,(2*test2[1]+1)/3)) print uitkomst1 een=sum(3*x-1 for (y,x) in uitkomst1 if 3*x-110^9) print uitkomst2 twee=sum(3*x+1 for (y,x) in uitkomst2 if 3*x+110^9) print een+twee It prints 288675135 ... and I got bored waiting for the rest... OK, I got really tired of waiting, and just wrote a cython version of the above, which does it for 10^9 in 25 seconds. It's over 200 times faster than your code. See attached worksheet or paste this into a notebook cell and press shift enter, then do f(10^9): %cython from sage.all import is_square cdef extern from math.h: long double sqrtl(long double) def f(n): uitkomst1=[] uitkomst2=[] cdef long long eind=int((n+2)/(2*sqrt(3))) cdef long long y, t print eind for y in range(1,eind): t = long longsqrtl(long long (3*y*y + 1)) if t * t == 3*y*y + 1: uitkomst1.append((y, (2*t-1)/3)) t = long longsqrtl(long long (48*y*y + 1)) if t * t == 48*y*y + 1: uitkomst2.append((y, (2*t+1)/3)) print uitkomst1 een=sum([3*x-1 for (y,x) in uitkomst1 if 3*x-110^9]) print uitkomst2 twee=sum([3*x+1 for (y,x) in uitkomst2 if 3*x+110^9]) print een+twee I don't guarantee there isn't some funny overflow or wrongness with the above. All I claim is that it is faster than you'll get use any interprter. William sage_support_Rolandb.sws 27KWeergevenDownloaden --~--~-~--~~~---~--~~ 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] numerical_sqrt?
Hi, what is the use of this function? It seems equivalent to sqrt. Roland --~--~-~--~~~---~--~~ 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: derivative
This works: f=arccos((1-x^2)/(1+x^2)) g=f.diff(x) g.simplify_full() 2*x/((x^2 + 1)*abs(x)) In general: type g. TAB and you will find all kind of handy functions. Roland On 28 feb, 10:58, Loïc xl...@free.fr wrote: Hello Another problem: I want the derivative for the function arccos((1-x^2)/(1+x^2)) I wrote: f=arccos((1-x^2)/(1+x^2)) f.diff(x) -(-2*x/(x^2 + 1) - 2*x*(1 - x^2)/(x^2 + 1)^2)/sqrt(1 - (1 - x^2)^2/ (x^2 + 1)^2) The best answer would be: 2/(1+x^2)*sign(x) How can I simplify this expression to get this answer? Best Loïc --~--~-~--~~~---~--~~ 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] Can not load *.sws file
Hi, I saved my notebook files to *.sws files, and I installed SAGE 3.4. However, I can not load a particular sws file. Can I send the file to somebody to have a look at it? Thanks in advance! Roland --~--~-~--~~~---~--~~ 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: Can not load *.sws file
I solved my problem via KAIST 3.2.3. Size file was 13MB, maybe that's a problem. On 17 mrt, 07:17, Rolandb rola...@planet.nl wrote: Hi, I saved my notebook files to *.sws files, and I installed SAGE 3.4. However, I can not load a particular sws file. Can I send the file to somebody to have a look at it? Thanks in advance! Roland --~--~-~--~~~---~--~~ 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] Unexpected behavior of remove
Hi, I didn't expect that whole M would be effected. M=[[0..9]]*3 print M[0] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] M[1].remove(9) print M [[0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8], [0, 1, 2, 3, 4, 5, 6, 7, 8]] Rolandb --~--~-~--~~~---~--~~ 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] Update R to the 2.9 release with milestone Sage 4.0
Hi Ticket #3086 states Update R to the 2.7 release and split off rpy.spkg with milestone Sage 4.0. If possible, two requests: 1) Update R to the latest 2.9 release (now sage 3.4 uses R version 2.6.1 (2007-11-26)) 2) To use R one has to load various additional packages. For instance I use the following lines: import rpy pack=[abind, distr, distrEx, e1071, effects, foreign, grid, lattice, lmtest, MASS, mgcv, multcomp,Rcmdr] for p in pack: r.install_packages(p) As the policy of Sage is all inclusive, I suggest rpy includes the most common R packages. Thanks in advance! Roland --~--~-~--~~~---~--~~ 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: Update R to the 2.9 release with milestone Sage 4.0
Release 4.0 is soon. So I suggest we split the work. 1) Update R to the latest 2.9 release (ticket #3086) I have no development experiences, but I assume that updating is a straightforward activity (but maybe I'm wrong). 2) Loading common packages in advance. After release 4.0 we look how many users have the same needs. If its really worthwhile, we can consider to take the next step. Roland On 2 mei, 09:30, William Stein wst...@gmail.com wrote: On Sat, May 2, 2009 at 12:26 AM, Rolandb rola...@planet.nl wrote: Hi Ticket #3086 states Update R to the 2.7 release and split off rpy.spkg with milestone Sage 4.0. If possible, two requests: 1) Update R to the latest 2.9 release (now sage 3.4 uses R version 2.6.1 (2007-11-26)) 2) To use R one has to load various additional packages. For instance I use the following lines: import rpy pack=[abind, distr, distrEx, e1071, effects, foreign, grid, lattice, lmtest, MASS, mgcv, multcomp,Rcmdr] for p in pack: r.install_packages(p) As the policy of Sage is all inclusive, I suggest rpy includes the most common R packages. Thanks in advance! Is there any chance you could help with making the above happen? You might be the biggest user of R in Sage in the world. 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] Operators and ?
Hi, (13 3) equals 104, and (13 3) equals 1. I could not find these operators in the documentation. Were are and explained? Thank in advance! Rolandb --~--~-~--~~~---~--~~ 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] Save our Souls
Hi, I’m away for three weeks and I want to let my PC doing some calculations during 20 days. Now, I’m running the risk that after a few days the computer stops et cetera, so that the results are lost. What are save ways to store results? I expect that the total output is a few Mb. What I would like to avoid is a slow process (subroutine) that does the trick. Any ideas? Thanks in advance! Rolandb --~--~-~--~~~---~--~~ 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] Problem with larger sws files
Hi, Already in March I reported this problem. http://groups.google.com/group/sage-support/browse_thread/thread/1dbc0160a9d70c5/ae5e660def75547?q=#0ae5e660def75547 Uploading a small file is going well, but a file larger then 3Mb takes ages where after the connection is aborted. Using Sage 4.1, VMware (Windows). Your help is much appreciated! Rolandb --~--~-~--~~~---~--~~ 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] Simplify an expression
Hi, How to simplify an expression if you have some known relations (equalities)? Example: relation: 0 = a*x1^2 + b*x2^2 expression = (a*x1^2 + b*x2^2)*y1+b*y2^3 Given the relation, the expression could be simplified to b*y2^2. But how in Sage? Tnx in advance. Rolandb --~--~-~--~~~---~--~~ 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: Simplify an expression
Simon, thanks! But in general there is no (Sage) algoritm to simplify expressions given some equalities? Rolandb On 21 jul, 08:05, Simon King simon.k...@uni-jena.de wrote: Hi Roland, On 21 Jul., 06:33, Rolandb rola...@planet.nl wrote: Hi, How to simplify an expression if you have some known relations (equalities)? Example: relation: 0 = a*x1^2 + b*x2^2 expression = (a*x1^2 + b*x2^2)*y1+b*y2^3 Are all your relations polynomial? Then the standard solution is to use Gröbner bases and reduction. For example: sage: R.x,y,z = QQ[] sage: I = [x*y+z,y*z+x]*R So, the ideal I contains some relations, namely x*y+z=0 and y*z+x=0, and all of its consequences. It is easy to see that x^2-z^2 is a consequence of the relations. Indeed: sage: G = I.groebner_basis() sage: G [x^2 - z^2, x*y + z, y*z + x] sage: f = x^2 + x*y*z + x*z sage: f.reduce(G) x*z Of course, it is essential that one uses a Gröbner basis in the reduction: The original generating set of I is not appropriate: sage: (x^2-z^2).reduce(I) x^2 - z^2 sage: (x^2-z^2).reduce(G) 0 Cheers, 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 http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] A weird exception?
Hi, I came across an amazing difference in execution time. Consider: sage: def heelsnel(reeks,maxum): ... ... def expon(mx,g): return floor(log(mx)/log(g))+1 ... ... if len(reeks)==1: return expon(maxum,reeks[0]) ... tel=0 ... for k in range(1,expon(maxum,reeks[-1])): ... tel+=heelsnel(reeks[:-1],int(maxum/reeks[-1]^k)) ... return tel For example if reeks=[2,3] the execution is fast. Thus: sage: heelsnel([2,3],10^8+1) Also for all other combinations of p,q, thus reeks=[p,q]. There is one weird execption: reeks=[2,5], e.g. sage: heelsnel([2,5],10^8+1). Profile.run shows that suddenly many functions are called which seems odd for such a simple recursive function. Why? Thanks in advance! Rolandb --~--~-~--~~~---~--~~ 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: A weird exception?
On 29 aug, 18:43, John H Palmieri jhpalmier...@gmail.com wrote: On Aug 29, 8:51 am, Simon King simon.k...@nuigalway.ie wrote: Note that expon uses Maxima, because you use the logarithm. So, I reckon that your problem is related withhttp://trac.sagemath.org/sage_trac/ticket/4731 andhttp://trac.sagemath.org/sage_trac/ticket/6818. If not, you might try to work around by thinking what expon really does. For example, one of my first problems with Sage occurred when I used the logarithm for determining the number of digits of a natural number n -- len(str(n)) is much faster! Or you can use math.log instead of log -- this should use the Python log function rather than the Maxima one: use def expon(mx,g): return floor(math.log(mx)/math.log(g))+1 John Hi, The whole issue boils down to: floor(log(256)/log(2))+1 which takes 'ages' to compute (Sage 4.1). print floor(ln(256)/ln(2))+1 is no improvement; floor(math.log(mx)/ math.log(g))+1 is. Rolandb --~--~-~--~~~---~--~~ 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: A weird exception?
Hi, Using math.log has a disadvantage; it is less accurate. sage: print n(math.log(2),100) sage: print n(log(2),100) 0.69314718055994528622676398300 0.69314718055994530941723212146 Rolandb On 30 aug, 06:48, Robert Bradshaw rober...@math.washington.edu wrote: On Aug 29, 2009, at 12:44 PM, Rolandb wrote: On 29 aug, 18:43, John H Palmieri jhpalmier...@gmail.com wrote: On Aug 29, 8:51 am, Simon King simon.k...@nuigalway.ie wrote: Note that expon uses Maxima, because you use the logarithm. So, I reckon that your problem is related withhttp://trac.sagemath.org/ sage_trac/ticket/4731 andhttp://trac.sagemath.org/sage_trac/ticket/6818. If not, you might try to work around by thinking what expon really does. For example, one of my first problems with Sage occurred when I used the logarithm for determining the number of digits of a natural number n -- len(str(n)) is much faster! Or you can use math.log instead of log -- this should use the Python log function rather than the Maxima one: use def expon(mx,g): return floor(math.log(mx)/math.log(g))+1 John Hi, The whole issue boils down to: floor(log(256)/log(2))+1 which takes 'ages' to compute (Sage 4.1). print floor(ln(256)/ln(2))+1 is no improvement; floor(math.log(mx)/ math.log(g))+1 is. Ah, that makes sense. It is numerically computing this to higher and higher precision, trying to figure out whether or not it is greater than or less than 8. Of course, you can't do this with high precision arithmetic, so eventually it gives up. What we should do is also try to check to see if it is exactly equal to an integer symbolically before computing out too far...maybe even do both in parallel. sage: bool(log(256)/log(2) == 8) True - Robert --~--~-~--~~~---~--~~ 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: A weird exception?
On 1 sep, 11:08, Robert Bradshaw rober...@math.washington.edu wrote: On Aug 29, 2009, at 11:05 PM, Rolandb wrote: Hi, Using math.log has a disadvantage; it is less accurate. sage: print n(math.log(2),100) sage: print n(log(2),100) 0.69314718055994528622676398300 0.69314718055994530941723212146 Yes, it is. Accuracy vs. speed is a common tradeoff one needs to make. If you're going for a numerical answer, log(2).n(1000) will give you 1000 bits of precision. Adjust as you see fit for your application. - Robert Hi Robert, I tested several solutions and I found that there is a much better approach. def expon1(mx,g): return int(ln(mx)/ln(g))+1 def expon2(mx,g): return floor(log(mx)/log(g))+1 def expon3(mx,g): return floor(ln(mx)/ln(g))+1 def expon4(mx,g): return floor(math.log(mx)/math.log(g))+1 def expon5(mx,g): return floor(n(log(mx),100)/n(log(g),100))+1 def expon6(mx,g): if gmx: return 1 k=0 m=g while m*g=mx: m=m*g k+=1 return k+2 1. 625 loops, best of 3: 1.15 ms per loop 2. 625 loops, best of 3: 998 µs per loop 3. 625 loops, best of 3: 993 µs per loop 4. 625 loops, best of 3: 6.77 µs per loop 5. 625 loops, best of 3: 696 µs per loop 6. 625 loops, best of 3: 7.71 µs per loop Roland The last method is best, although I didn't expected it to be. --~--~-~--~~~---~--~~ 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] SAGE notebook: worksheet not readable
Hi, I worked on a worksheet rolandtest4 (owner rolandb) but this file seems unreadable. Can somebody fix it? Thanks! --~--~-~--~~~---~--~~ 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~--~~~~--~~--~--~---
[sage-support] Sage notebook works, but extremely slow ...?
Hi, I use SAGE 2.6.17 and Firefox 2.0.0.5. Until a few days ago it worked fine on my Toshiba Terca. Now it still works, but it takes ages for Firefox to load pages so all speed has gone. I tried all kind of options as firewalls on/out, various network options et cetera, but now I'm slowly moving towards a more desperate mood. Can somebody sheer me up by suggestions how to fix this problem? Thanks in advance! Roland --~--~-~--~~~---~--~~ 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://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/ -~--~~~~--~~--~--~---
[sage-support] Problem
The following problem occured and I don't understand what the mistake is using isqrt. Please help. Thanks in advance. I use Sage 3.0.0. Roland sage: for n in range(1,10): ...print n, isqrt(n) 1 Traceback (most recent call last): File stdin, line 1, in module File /home/notebook/sage_notebook/worksheets/admin/16/code/7.py, line 6, in module exec compile(ur'for n in range(Integer(1),Integer(10)):\u000a print n, isqrt(n)' + '\n', '', 'single') File /usr/local/sage/local/lib/python2.5/site-packages/sympy/ plotting/, line 2, in module File /usr/local/sage/local/lib/python2.5/site-packages/sage/misc/ functional.py, line 956, in isqrt raise NotImplementedError NotImplementedError --~--~-~--~~~---~--~~ 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: Problem
Tnx On 22 mei, 07:02, Justin C. Walker [EMAIL PROTECTED] wrote: On May 21, 2008, at 21:14 , Roland van den Brink wrote: The following problem occured and I don't understand what the mistake is using isqrt. Please help. Thanks in advance. I use Sage 3.0.0. Roland sage: for n in range(1,10): ...print n, isqrt(n) 1 Traceback (most recent call last): File stdin, line 1, in module File /home/notebook/sage_notebook/worksheets/admin/16/code/7.py, line 6, in module exec compile(ur'for n in range(Integer(1),Integer(10)):\u000a print n, isqrt(n)' + '\n', '', 'single') File /usr/local/sage/local/lib/python2.5/site-packages/sympy/ plotting/, line 2, in module File /usr/local/sage/local/lib/python2.5/site-packages/sage/misc/ functional.py, line 956, in isqrt raise NotImplementedError NotImplementedError This looks like a bug: sage: for n in range(1,10): print n, isqrt(Integer(n)) : 1 1 2 1 3 1 4 2 5 2 6 2 7 2 8 2 9 3 isqrt() doesn't like 'int' arguments. Thoughts? Justin -- Justin C. Walker, Curmudgeon-At-Large Institute for the Absorption of Federal Funds Men are from Earth. Women are from Earth. Deal with it. --~--~-~--~~~---~--~~ 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] Update SAGE: sws files lost!
A huge dissatisfier for the third time .. I update VMARE (to version 2.04) and thereafter SAGE (from 3.0 to 3.0.3). This is the third time I lost all my notebook files (sws) ... How can this be avoided!! Please help, because many days of work are now 'lost'. Thanks in advance. Roland --~--~-~--~~~---~--~~ 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] Replace?
Hi. Look at this: vv='abc' print vv[0] vv.replace('b','n') print vv vv.replace('b','n') The answers are different!?... Roland --~--~-~--~~~---~--~~ 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] Download version 3.1.1 on http://www.sagemath.org/ ?
Hi. All download spots have only version 3.0.6...? For example http://www.sagemath.org/bin/microsoft_windows/ Roland --~--~-~--~~~---~--~~ 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] Intended or unintended recursion?
Hi. The following programme looks simple: sage: def posible_values(row,found,maxum): ...result=found ...if row==[]: row=[1] ...if result==[]: result=found=row #Recursion: intended or unintended? ...if max(row)maxum: ... for k in found: ... for p in row: ... if k*p maxum: ...if k*p not in result: result.append(k*p) ...return result ... sage: print posible_values([2,3,5],[],100) [2, 3, 5, 4, 6, 10, 8, 12, 20, 16, 24, 40, 32, 48, 80, 64, 96, 9, 15, 18, 30, 36, 60, 72, 27, 45, 54, 90, 81, 25, 50, 75] To me is the possibility of recursion this way a great plus, but in all documents I could not find any reference. So is this intended in Python/SAGE or is the above example just bad programming? Roland --~--~-~--~~~---~--~~ 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: Intended or unintended recursion?
Dear John, Tnx! But it looks alike. Just add a print command and see how the list found increases and the variable k picks up the new added numbers to the list result. sage: def posible_values(row,found,maxum): ...result=found ...if row==[]: row=[1] ...if result==[]: result=found=row #Recursion: intended or unintended? ...if max(row)maxum: ... for k in found: ... print k=,k,found, found ... for p in row: ... if k*p maxum: ...if k*p not in result: result.append(k*p) ...return result ... sage: print posible_values([2,5],[],10) k= 2 found [2, 5] k= 5 found [2, 5, 4, 8] k= 4 found [2, 5, 4, 8] k= 8 found [2, 5, 4, 8] [2, 5, 4, 8] To me this is recursion look-a-like. Roland On 25 aug, 11:22, John Cremona [EMAIL PROTECTED] wrote: This does not look recursive to me, since possible_values() does not call itself. John 2008/8/25 Rolandb [EMAIL PROTECTED]: Hi. The following programme looks simple: sage: def posible_values(row,found,maxum): ... result=found ... if row==[]: row=[1] ... if result==[]: result=found=row #Recursion: intended or unintended? ... if max(row)maxum: ... for k in found: ... for p in row: ... if k*p maxum: ... if k*p not in result: result.append(k*p) ... return result ... sage: print posible_values([2,3,5],[],100) [2, 3, 5, 4, 6, 10, 8, 12, 20, 16, 24, 40, 32, 48, 80, 64, 96, 9, 15, 18, 30, 36, 60, 72, 27, 45, 54, 90, 81, 25, 50, 75] To me is the possibility of recursion this way a great plus, but in all documents I could not find any reference. So is this intended in Python/SAGE or is the above example just bad programming? Roland --~--~-~--~~~---~--~~ 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: Download version 3.1.1 on http://www.sagemath.org/ ?
Hi. It would be great if with release 3.1.2 a Windows version is available without too much delay. Tnx! Roland On 21 aug, 06:30, William Stein [EMAIL PROTECTED] wrote: On Wed, Aug 20, 2008 at 9:26 PM, Rolandb [EMAIL PROTECTED] wrote: Hi. All download spots have only version 3.0.6...? For example http://www.sagemath.org/bin/microsoft_windows/ There are 3.1.1 binaries for every architecture except windows. There will not be updated Windows binaries until either (1) somebody else builds them, or (2) I get back to Seattle (Monday, September 1). I hope Michael Abshoff will build a new windows(vmware) binary tomorrow... -- William --~--~-~--~~~---~--~~ 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: problem with range, int, Integer and division in a loop
Tnx! srange does the tric. Maybe srange (instead of range) should be promoted far more for this reason! Roland On 6 sep, 00:52, Timothy Clemans [EMAIL PROTECTED] wrote: srange gives a list of Sage integers and follows the syntax of range. On Fri, Sep 5, 2008 at 5:41 PM, Harald Schilly [EMAIL PROTECTED] wrote: hello roland I cross posted this on the sage-support mailing list http://groups.google.com/group/sage-support regarding your bugreport: http://spreadsheets.google.com/pub?key=pCwvGVwSMxTzT6E2xNdo5fA In loop /' operand incorrect Hi. Please view worksheet which is publicly viewable athttp://75.75.6.176:80/home/pub/0 In a loop, and only then, suddenly 583/2 becomes 291 ...? Roland, sage 3.1.1 on Windows/VMWare the problem is, that range is a native python command and all this happens because it is python only. if you just enter numbers, sage preparses them as Integer(n) .. then they are more complex objects. there is not much to do about this, either convert to sage integers or well, someone has to break python - but that's extremely dangerous. so, as long as i understood your lengthy example correct, here are two commands, run in pure python to clarify: for i in range(1,6): print i/2 ... 0 1 1 2 2 for i in range(1,6): print float(i)/2 ... 0.5 1.0 1.5 2.0 2.5 - in sage sage: preparse(for i in range(1,6): print i/2) 'for i in range(Integer(1),Integer(6)): print i/Integer(2)' above, division by an integer! sage: for i in range(1,6): print i/2 : 1/2 1 3/2 2 5/2 also, you can use the type command to get the objects type. native integers are int and sage's Integer 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] Operand % and SymbolicVariable do not match?
Hi. I want to use x%y for two variables x,y. This doesn't work as the following example shows: sage: var('x,y') sage: def proc(a,b): return a%b sage: print proc(6,3) sage: print proc(x,y) 0 Traceback (most recent call last): File stdin, line 1, in module File /home/notebook/sage_notebook/worksheets/admin/38/code/13.py, line 9, in module exec compile(ur'print proc(x,y)' + '\n', '', 'single') File /usr/local/sage/local/lib/python2.5/site-packages/sympy/ plotting/, line 1, in module File /home/notebook/sage_notebook/worksheets/admin/38/code/13.py, line 7, in proc def proc(a,b): return a%b TypeError: unsupported operand type(s) for %: 'SymbolicVariable' and 'SymbolicVariable' What to do? Roland --~--~-~--~~~---~--~~ 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: Lost notebook worksheets after updating
Several times I indicated the same problem but until now no action. I just save my worksheets (around 30) manually and recover the *.sws files one by one in the new SAGE version. Life is hard Roland On 29 sep, 14:11, Daniel Loughran [EMAIL PROTECTED] wrote: I am currently using sage on windows, and I recently upgraded my sage to the latest version, but was disappointed to discover that the notebook had been reset and I had lost all my worksheets. Is there anyway to recover them? Or to save them externally so that I do not lose them again? Shouldnt there be some sort of warning somewhere in the installation process so that you know you are going to lose everything? --~--~-~--~~~---~--~~ 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] Motion planets
Hi, I'm interested in the motion of planets around the sun. Before I 'reinvent the wheel', maybe someone has made a simple model and he/she is willing to share it? Thanks in advance! Rolandb --~--~-~--~~~---~--~~ 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: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Remove?
Hi, print [1,2,3,4].remove(4) None I would expect [1,2,3] Rolandb --~--~-~--~~~---~--~~ 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: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] gcd bug?
Hi. Look at: R.A,B=QQ[] expr=(A,B) (a,b)=sorted([abs(expr[n]([2,16])) for n in [0,1]]) print a,b,a.gcd(b) I got: 2 16 1 I expected: 2 16 2 Reason? Roland -- 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: http://www.sagemath.org
[sage-support] SIGSEGV ERROR
Hi, Unhandled SIGSEGV: A segmentation fault occured in SAGE. This probably occured because a *compiled* component of SAGE has a bug in it (typically accessing invalid memory) or is not properly wrapped with _sig_on, _sig_off. You might want to run SAGE under gdb with 'sage -gdb' to debug this. SAGE will now terminate (sorry). What to do? Roland -- 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: http://www.sagemath.org
[sage-support] Re: SIGSEGV ERROR
I located the file at https://:8000/home/pub/0 SIGSEGV with version 4.1, Windows. I did not compile it from source. No output at all with version 4.2.1 using KAIST. On 29 nov, 20:50, Burcin Erocal bur...@erocal.org wrote: Hi Roland, On Sun, 29 Nov 2009 11:46:00 -0800 (PST) Rolandb rola...@planet.nl wrote: Unhandled SIGSEGV: A segmentation fault occured in SAGE. This probably occured because a *compiled* component of SAGE has a bug in it (typically accessing invalid memory) or is not properly wrapped with _sig_on, _sig_off. You might want to run SAGE under gdb with 'sage -gdb' to debug this. SAGE will now terminate (sorry). What to do? Roland Can you post the exact sequence of commands leading up to this message? It would be great if you also provide some more information. What version of Sage are you using? On which platform? Did you compile it from source? Thanks. Burcin -- 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: http://www.sagemath.org
[sage-support] Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk'
Hi, How serious is the following message? Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk' or one of the snapshot disks it depends on. Reason: Failed to lock the file. Roland -- 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: http://www.sagemath.org
[sage-support] Re: Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk'
Hi, Sage fails to start. Does this mean that I lost all my notebook files? That would be very sad... Thanks in advance of a solution which save my files!! Roland On 1 dec, 04:57, Rolandb rola...@planet.nl wrote: Hi, How serious is the following message? Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk' or one of the snapshot disks it depends on. Reason: Failed to lock the file. Roland -- 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: http://www.sagemath.org
[sage-support] Re: Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk'
I tried everything I could imagine: restarting VMWARE, inspection of the individual vdmk files, restarting the computer, ... It seems that I have to re-install Sage (for Windows). The problem is that by re-installing, I will loose all my notebook files. So, I want to save those files first! BUT HOW? Roland On 1 dec, 21:57, Robert Bradshaw rober...@math.washington.edu wrote: I don't know much about Windows, but did you try restarting? That might release any stale file locks. (Don't worry, your data should still be there.) On Dec 1, 2009, at 11:00 AM, Rolandb wrote: Hi, Sage fails to start. Does this mean that I lost all my notebook files? That would be very sad... Thanks in advance of a solution which save my files!! Roland On 1 dec, 04:57, Rolandb rola...@planet.nl wrote: Hi, How serious is the following message? Cannot open the disk 'D:\Program Files\Sage\sage- vmware-4.1\disk.vmdk' or one of the snapshot disks it depends on. Reason: Failed to lock the file. Roland -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- 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: http://www.sagemath.org
[sage-support] Re: Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk'
Hi William, The 7zip file is 0.98 Gb, but I don't have a online place to download it to. Is there an other solution? Roland On 2 dec, 06:10, William Stein wst...@gmail.com wrote: On Mon, Nov 30, 2009 at 10:57 PM, Rolandb rola...@planet.nl wrote: Hi, How serious is the following message? Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk' or one of the snapshot disks it depends on. Reason: Failed to lock the file. Do you have enough disk space? Do you have permissions? Can you run as an admin? How big are all the files in sage-vmware-4.1? Could you consider using 7zip to zip (or whatever) to zip up the whole directory and somehow make it available online, so somebody else can try to mount your disks and get your files? 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 URL: http://www.sagemath.org
[sage-support] Re: Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk'
Dear William, The Sage files can be downloaded via http://rapidshare.com/files/315349439/sage-vmware-4.1.7z Maybe I should add that my problem arose due to fact that due to the SIGSEGV ERROR I had to restart my computer. Thanks in advance for considering my problem! Roland On 2 dec, 06:10, William Stein wst...@gmail.com wrote: On Mon, Nov 30, 2009 at 10:57 PM, Rolandb rola...@planet.nl wrote: Hi, How serious is the following message? Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk' or one of the snapshot disks it depends on. Reason: Failed to lock the file. Do you have enough disk space? Do you have permissions? Can you run as an admin? How big are all the files in sage-vmware-4.1? Could you consider using 7zip to zip (or whatever) to zip up the whole directory and somehow make it available online, so somebody else can try to mount your disks and get your files? 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 URL: http://www.sagemath.org
[sage-support] Re: Cannot open the disk 'D:\Program Files\Sage\sage-vmware-4.1\disk.vmdk'
Dear Robert, I removed the maps *.lcd: no solution. I cleaned my registry: no solution I restarted my computer: no solution . I became angry and I saved all disk*.* files, I installed Sage for Windows again and replaced the new disk*.* files with the old files Guess what: problem solved! Maybe something for FAQ if people experience a SIGSEGV ERROR. Thanks for all your support. Roland On 3 dec, 05:45, Robert Bradshaw rober...@math.washington.edu wrote: On Dec 1, 2009, at 9:24 PM, dimpase wrote: well, you probably just need to remove some stale locks. That is, somewhere on the VM, there is a place where files indicating busy status of a particular volume, so-called locks, are stored. On Windows hosts, they have .lck extensions. So you need to remove the one that is causing you the trouble. However, a VM reboot should have taken care of it. (YMMV: It has been ages since I worked with VMware, so I might sound vague on this) In other words, are there any .lck files sitting around your virtual disks that you should delete, like a D:\Program Files\Sage\sage- vmware-4.1\disk.vmdk.lck? . That alone might solve the problem. - Robert -- 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: http://www.sagemath.org
[sage-support] Memory problem?
Hi, I encounterd a memory problem. The file can be found on http://www.sagenb.org/home/rolandb/3/ ( http://:/home/pub/1204 ), and is also listed below. I use version 4.1, Windows. Although it seems a simple set of lines, after two/three minutes my hard disk starts to make a lot of noise and often I have to reboot the whole computer. Why? sage: R.A,B,C=QQ[] sage: slimme_formule=[(A^5, 5*A^4*B + 10*A^3*B^2 + 10*A^2*B^3 + 5*A*B^4 + B^5, C^5), (A^5, sage: B^5, A^4*C - A^3*B*C + A^2*B^2*C - A*B^3*C + B^4*C), (A^4 + 6*A^3*B + sage: 12*A^2*B^2 + 8*A*B^3, 2*A*B^3 + 3*B^4, A*C^3 + 3*B*C^3), (-A^4 + sage: 2*A^2*C^2, 4*A^2*B^2 + 4*A*B^3 + B^4, C^4), (A^4 + 4*A^3*B + 6*A^2*B^2, sage: 4*A*B^3 + B^4, C^4), (A^4, 4*A*B^3 + 3*B^4, A^2*C^2 - 2*A*B*C^2 + sage: 3*B^2*C^2), (A^4, A^3*C - A^2*B*C + A*B^2*C - B^3*C, B^4), (A^4, 2*A^3*B sage: + A^2*B^2 + 2*A*B*C^2 + B^2*C^2, C^4), (A^4, 2*A^2*C^2 - C^4, 4*A^2*B^2 sage: + 4*A*B^3 + B^4), (-A^4 + 2*A^3*B, 2*A*B^3 - B^4, A^3*C - 3*A^2*B*C + sage: 3*A*B^2*C - B^3*C), (A^2*B^2 + 2*A*B^3 + A^2*C^2 + 2*A*B*C^2, B^4, C^4), sage: (A^4 + 4*A^3*B + 4*A^2*B^2, -2*B^2*C^2 + C^4, B^4), (A^3, 9*A^2*B + sage: 6*A*B^2 + B^3, 4*A*C^2 + B*C^2), (A^3 + 3*A^2*B + 3*A*B^2, B^3, C^3), sage: (A^3, A*C^2 - 2*B*C^2, 3*A*B^2 + 2*B^3), (A^3, 3*A^2*B + 3*A*B^2 + B^3, sage: C^3), (A^3, B^3, A^2*C - A*B*C + B^2*C), (A^3 + 6*A^2*B + 9*A*B^2, B^3, sage: A*C^2 + 4*B*C^2), (A^3 + 3*A^2*B, 3*A*B^2 + B^3, C^3), (2*A^3 + 3*A^2*B, sage: 2*A*C^2 - B*C^2, B^3), (A^2, 2*A*B + B^2, C^2), (A^2, A*C - B*C, B^2), sage: (A^2 + 2*A*B, B^2, C^2)] sage: R.A,B,C=QQ[] sage: def minimaal(expr): ... uit=1 ... for w in (expr.subs(C=A+B)).factor(): ... mogelijk=[w[0],w[0].subs(A=C-B),w[0].subs(B=C-A)] ... keuze=map(lambda x: len(x.dict()),mogelijk) ... uit=uit*mogelijk[keuze.index(min(keuze))]^w[1] ... return uit ... sage: minimaal((A+B)^6*(2*A+B)^2*A^3*B^4).factor() (2*A + B)^2 * A^3 * B^4 * C^6 sage: def vulin(exp1,exp2): ... R.D,E,F=QQ[] ... return tuple(map(lambda x: minimaal(x.subs(A=D,B=E,C=F).subs (D=exp2[0],E=exp2[1],F=exp2[2])),exp1)) ... sage: R.A,B,C=QQ[] sage: exp1=(A^2, -A*C + B*C, B^2) sage: exp2=(A*B + A*C, B^2, C^2) sage: vulin(exp1,exp2) (A^4 + 4*A^3*B + 4*A^2*B^2, -2*B^2*C^2 + C^4, B^4) sage: def succes(ABC_trio): ... slim=False ... faktoren=list(prod(ABC_trio).subs(C=A+B).factor()) ... tel_fact=sum([w[1] for w in faktoren if w[0] not in [A,B,A +B]])-1 ... if tel_fact==-1: tel_fact=1 ... tel_ABC=sum([w[1] for w in faktoren if w[0] in [A,B,A+B]]) ... test=tel_fact+2*tel_ABC-(7/2)*(max(map(lambda x:x.degree (),ABC_trio))-1) ... if test6: slim=True ... return slim ... ... sage: print succes((A^4, A^3*B + 2*A^3*C + 3*B^3*C + 3*A*B*C^2 - 2*A*C^3, 3*A*B^3 + 3*B^4 - 3*A^2*B*C - B*C^3 + C^4)) sage: print succes((A,B,C)) True True sage: R.A,B,C=QQ[] sage: aantal=23 sage: groot_slim=[] sage: for exp1 in slimme_formule[:aantal]: ... for exp2 in slimme_formule[:aantal]: ... exp12=vulin(exp1,exp2) ... for exp3 in slimme_formule[:aantal]: ... nwerelatie=vulin(exp12,exp3) ... if succes(nwerelatie): ... gevonden=tuple(map(lambda x: slimme_formule.index (x),[exp1,exp2,exp3])) ... print gevonden, ... groot_slim.append(gevonden) -- 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: http://www.sagemath.org
[sage-support] 4*A^3: How to separate the number 4?
Hi, gg=4*A^3 gg.factor() (4) * A^3 How to separate the number 4? Nor gg.dict() nor list(gg.factor()) has the number 4. Remarkable is also the output of gg.factor()/4: (4) * 4^-1 * A^3 Roland -- 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: http://www.sagemath.org
Re: [sage-support] 4*A^3: How to separate the number 4?
Dear Mike, Thanks! A real gift. I wonder how I could find such a solution myself? That is my only, but serious, problem with Sage. Where to find an adequate solution for a problem Hopefully this will be solved in the comming years. For instance via an expert system. Roland Mike Hansen schreef: On Sat, Dec 5, 2009 at 11:01 PM, Rolandb rola...@planet.nl wrote: Hi, gg=4*A^3 gg.factor() (4) * A^3 How to separate the number 4? Nor gg.dict() nor list(gg.factor()) has the number 4. gg.factor().unit() should give it to you. --Mike -- 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: http://www.sagemath.org
[sage-support] Sorted inconsistent?
Hi, consider: R.A,B,C=QQ[] print sorted([(A, 3), (A - 2*B, 1)]) print sorted([(-A + 2*B, 1), (A, 3)]) Outcome not equal. Issue of Python or Sage? Roland -- 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: http://www.sagemath.org
[sage-support] ValueError: Unable to solve
Hi, The following message amazes me, because if an equation is unsolvable I would assume [] as output. ValueError: Unable to solve [x^3 + 3*x^2*y + 3*x*y^2 == 45487, y^3 == 549755813888] for (x, y) Roland -- 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: http://www.sagemath.org
[sage-support] Fast Ramanujan's tau function
Hi, Consider: def tau(m): q = PowerSeriesRing(QQ, 'q', default_prec=12).gen() pq=prod([(1-q^k)^24 for k in range(1,m)]) return pq.coefficients()[:m] tau(20) [1, -24, 252, -1472, 4830, -6048, -16744, 84480, -113643, -115920, 534612, -370944, -577738, 401856, 1217160, 987136, -6905934, 2727432, 10661420, -7109760] If m increases, this routine becomes is slow. Is there a fast routine (or table) for large m? Thanks in advance! Rolandb -- 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: http://www.sagemath.org
[sage-support] Solve_mod: a problem?
Hi, Consider: var('a,b') print solve_mod([a^2+7*b^2==23],101) [(4, 1), (4, 100), (5, 12), (5, 89), (7, 16), (7, 85), (8, 15), (8, 86), (11, 17), (11, 84), (14, 29), (14, 72), (15, 0), (18, 19), (18, 82), (19, 46), (19, 55), (20, 50), (20, 51), (22, 8), (22, 93), (24, 27), (24, 74), (29, 35), (29, 66), (30, 25), (30, 76), (31, 13), (31, 88), (35, 47), (35, 54), (36, 7), (36, 94), (38, 10), (38, 91), (40, 11), (40, 90), (41, 14), (41, 87), (43, 24), (43, 77), (45, 44), (45, 57), (46, 2), (46, 99), (48, 39), (48, 62), (49, 18), (49, 83), (50, 33), (50, 68), (51, 33), (51, 68), (52, 18), (52, 83), (53, 39), (53, 62), (55, 2), (55, 99), (56, 44), (56, 57), (58, 24), (58, 77), (60, 14), (60, 87), (61, 11), (61, 90), (63, 10), (63, 91), (65, 7), (65, 94), (66, 47), (66, 54), (70, 13), (70, 88), (71, 25), (71, 76), (72, 35), (72, 66), (77, 27), (77, 74), (79, 8), (79, 93), (81, 50), (81, 51), (82, 46), (82, 55), (83, 19), (83, 82), (86, 0), (87, 29), (87, 72), (90, 17), (90, 84), (93, 15), (93, 86), (94, 16), (94, 85), (96, 12), (96, 89), (97, 1), (97, 100)] Thus for the first item (4,1) in the above list: 4^2+7*1^2 = 16+7*1 = 23 is a solution because 23%101=23. But why is the following list empty? print solve_mod([a^2+7*b^2==23],100) #Hundred [] Roland -- 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: http://www.sagemath.org
[sage-support] Re: Solve_mod: a problem?
Hi William, Some worries because solve_mod was broken already in version 4.1...! It seems that 'automatic' testing is more and more vital to keep SAGE clean / running safe. In the current setup users finds bugs by a 'random' process. Can (heavy) users help in a more structural manner? For instance, I have many worksheet with fixed outcomes. I assume many others have too. Not a big deal to run these worksheets as a check just after downloading a new release. A small (time) offer for a great community Interested? Roland On 1 feb, 00:43, William Stein wst...@gmail.com wrote: 2010/1/31 Rolandb rola...@planet.nl: Hi, Consider: var('a,b') print solve_mod([a^2+7*b^2==23],101) [(4, 1), (4, 100), (5, 12), (5, 89), (7, 16), (7, 85), (8, 15), (8, 86), (11, 17), (11, 84), (14, 29), (14, 72), (15, 0), (18, 19), (18, 82), (19, 46), (19, 55), (20, 50), (20, 51), (22, 8), (22, 93), (24, 27), (24, 74), (29, 35), (29, 66), (30, 25), (30, 76), (31, 13), (31, 88), (35, 47), (35, 54), (36, 7), (36, 94), (38, 10), (38, 91), (40, 11), (40, 90), (41, 14), (41, 87), (43, 24), (43, 77), (45, 44), (45, 57), (46, 2), (46, 99), (48, 39), (48, 62), (49, 18), (49, 83), (50, 33), (50, 68), (51, 33), (51, 68), (52, 18), (52, 83), (53, 39), (53, 62), (55, 2), (55, 99), (56, 44), (56, 57), (58, 24), (58, 77), (60, 14), (60, 87), (61, 11), (61, 90), (63, 10), (63, 91), (65, 7), (65, 94), (66, 47), (66, 54), (70, 13), (70, 88), (71, 25), (71, 76), (72, 35), (72, 66), (77, 27), (77, 74), (79, 8), (79, 93), (81, 50), (81, 51), (82, 46), (82, 55), (83, 19), (83, 82), (86, 0), (87, 29), (87, 72), (90, 17), (90, 84), (93, 15), (93, 86), (94, 16), (94, 85), (96, 12), (96, 89), (97, 1), (97, 100)] Thus for the first item (4,1) in the above list: 4^2+7*1^2 = 16+7*1 = 23 is a solution because 23%101=23. But why is the following list empty? print solve_mod([a^2+7*b^2==23],100) #Hundred [] Roland I reported this a few days ago to trac: http://trac.sagemath.org/sage_trac/ticket/8098 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 URL: http://www.sagemath.org
[sage-support] Solving a^2+n*b^2
Hi, Consider Euler’s famous expression x=a^2+n*b^2. I want to solve a and b, given x and n. Because solve_mod is totally broken, I tried to develop a clever method myself. Counterintuitively, I found that the most simple brute force method in SAGE is relatively fast. def bruteforce(number,n): out=[] for b in xrange(isqrt(number/n)): (bool,a)=is_square(number-n*b^2,True) if bool: out.append((a,b)) return out My questions are: - Why is the brute force method relatively fast? - Is there a clever approach (not dependent on solve_mod)? Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Re: Solving a^2+n*b^2
Thanks William, Actually I try to solve it for different x and n. A typical example of (x,n) is: %time bruteforce(7^10*29^5,973) [(3899224, 2437015)] CPU time: 25.88 s, Wall time: 26.12 s Roland On 7 feb, 22:29, William Stein wst...@gmail.com wrote: On Sun, Feb 7, 2010 at 12:35 PM, Rolandb rola...@planet.nl wrote: Hi, Consider Euler’s famous expression x=a^2+n*b^2. I want to solve a and b, given x and n. Because solve_mod is totally broken, I tried to develop a clever method myself. Counterintuitively, I found that the most simple brute force method in SAGE is relatively fast. def bruteforce(number,n): out=[] for b in xrange(isqrt(number/n)): (bool,a)=is_square(number-n*b^2,True) if bool: out.append((a,b)) return out My questions are: - Why is the brute force method relatively fast? - Is there a clever approach (not dependent on solve_mod)? Thanks in advance! Roland We have x=a^2+n*b^2 = (a-sqrt(n)*b)*(a+sqrt(n)*b) = Norm(a+sqrt(n)*b), where the norm is in the quadratic field Q(sqrt(n)). Thus a solution corresponds to a factorization of the ideal generated by x in the ring of integers of Q(sqrt(n)). So here is some code related to your question above, which you may or may not find relevant, depending on whether you're making n big or x: def eqn(x, n): Solve x = a^2+n*b^2 when x is prime, n is not a square, and there is a solution. EXAMPLES: sage: a,b = eqn(13, -3); a,b (4, 1) sage: a^2 + -3*b^2 13 sage: a,b = eqn(113, 97); a,b (-4, 1) sage: a^2 + 97*b^2 113 proof.number_field(False) assert is_prime(x), x must be prime assert not is_square(n), n must not be a square R.X = QQ[] K.a = NumberField(X^2 + n) F = K.factor(x) if len(F) == 1 and F[0][1] == 1: raise ValueError, no solution (x is inert) A = F[0][0].gens_reduced() if len(A) 1: raise ValueError, no solution (ideal isn't principal) return A[0][0], A[0][1] -- 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: http://www.sagemath.org
[sage-support] Re: Solving a^2+n*b^2
Alasdair, Thanks! On 9 feb, 11:54, Alasdair amc...@gmail.com wrote: Do a google search on Cornacchia's algorithm. Shouldn't be too hard to program in Sage (if it isn't there already). Alasdair On Feb 8, 4:07 pm, Rolandb rola...@planet.nl wrote: Thanks William, Actually I try to solve it for different x and n. A typical example of (x,n) is: %time bruteforce(7^10*29^5,973) [(3899224, 2437015)] CPU time: 25.88 s, Wall time: 26.12 s Roland On 7 feb, 22:29, William Stein wst...@gmail.com wrote: On Sun, Feb 7, 2010 at 12:35 PM, Rolandb rola...@planet.nl wrote: Hi, Consider Euler’s famous expression x=a^2+n*b^2. I want to solve a and b, given x and n. Because solve_mod is totally broken, I tried to develop a clever method myself. Counterintuitively, I found that the most simple brute force method in SAGE is relatively fast. def bruteforce(number,n): out=[] for b in xrange(isqrt(number/n)): (bool,a)=is_square(number-n*b^2,True) if bool: out.append((a,b)) return out My questions are: - Why is the brute force method relatively fast? - Is there a clever approach (not dependent on solve_mod)? Thanks in advance! Roland We have x=a^2+n*b^2 = (a-sqrt(n)*b)*(a+sqrt(n)*b) = Norm(a+sqrt(n)*b), where the norm is in the quadratic field Q(sqrt(n)). Thus a solution corresponds to a factorization of the ideal generated by x in the ring of integers of Q(sqrt(n)). So here is some code related to your question above, which you may or may not find relevant, depending on whether you're making n big or x: def eqn(x, n): Solve x = a^2+n*b^2 when x is prime, n is not a square, and there is a solution. EXAMPLES: sage: a,b = eqn(13, -3); a,b (4, 1) sage: a^2 + -3*b^2 13 sage: a,b = eqn(113, 97); a,b (-4, 1) sage: a^2 + 97*b^2 113 proof.number_field(False) assert is_prime(x), x must be prime assert not is_square(n), n must not be a square R.X = QQ[] K.a = NumberField(X^2 + n) F = K.factor(x) if len(F) == 1 and F[0][1] == 1: raise ValueError, no solution (x is inert) A = F[0][0].gens_reduced() if len(A) 1: raise ValueError, no solution (ideal isn't principal) return A[0][0], A[0][1] -- 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: http://www.sagemath.org
[sage-support] Problem with Virtualbox
Hi, I downloaded sage-virtualbox-4.3.zip, and installation went well. However, the second time I tried to use Virtualbox, I got the message Configuring network And now Firefox 3.5.8 can not find http:\ \192.168.56.101 What to do? Thanks in advance for a swift response! Roland -- 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: http://www.sagemath.org
[sage-support] How to use BPTJCubes.c from Flint?
Hi, Could someone please indicate how I can use (for instance) the routine BPTJCubes.c from the standard package Flint? Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Small bug?
Hi, using SAGE 4.1: %timeit('for k in xrange(2,10): factor(3+10^k)') 625 loops, best of 3: 1.08 ms per loop Traceback (most recent call last): File stdin, line 1, in module File /home/notebook/sage_notebook/worksheets/admin/18/code/65.py, line 6, in module print _support_.syseval(timeit('for k in xrange(2,10): factor(3+10^k)'), ur'''%timeit(\u0027for k in xrange(2,10): factor(3+10^k)\u0027)''', '/home/notebook/sage_notebook/worksheets/ admin/18/cells/48') File /usr/local/sage/local/lib/python2.6/site-packages/sage/server/ support.py, line 356, in syseval return system.eval(cmd, sage_globals, locals = sage_globals) AttributeError: 'NoneType' object has no attribute 'eval' Roland -- 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: http://www.sagemath.org
[sage-support] Some experiences
Hi, some experiences. I moved from Vista 32 to Windows 7 64 during Easter. I have a Q6700 PC. Three issues are maybe of general interest. 1) Virtualbox 4.3.4: A clumsy environment so I switched back to (the new) VMware player 3.01 and (the old) Sage 4.1. Now I was positively surprised how cool Sage works, and also the fact that I could run multiple Sage sessions all calculating ... But maybe my Virtualbox isn't properly installed? 2) I hoped for a considerable increase in speed, because 64bit optimized c code or assembly instructions are superior to 32bit. So I tested a few simple operations, and I noticed hardly any improvement! Did I installed the wrong version of Sage 4.1? I used sage- vmware-4.1.7z. 3) Whilst looking for need for speed, I found that many relatively simple standard sage functions aren't optimized. For instance CRT_list(v,moduli)?? states: if len(v) == 0: return 0 x = v[0] m = moduli[0] for i in range(1,len(v)): x = CRT(x,v[i],m,moduli[i]) m *= moduli[i] return x%m And CRT(a,b,m,n)??: if isinstance(a,list): return CRT_list(a,b) g, alpha, beta = XGCD(m,n) if g != 1: raise ValueError, arguments a and b must be coprime return a+(b-a)*alpha*m Just combining both gives: def crt_faster(v,moduli): x = v[0] m = moduli[0] for i in range(1,len(v)): x +=(v[i]-x)*xgcd(m,moduli[i])[1]*m m *= moduli[i] return x%m This improves speed by a factor of 1.5 to 2. - Is there in the near future an effort to optimize those relatively simple, but probably often used, routines? - What is the best way to check the most efficient routine? Installing packages like FLINT? Roland -- 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: http://www.sagemath.org
[sage-support] Some leakage?
Hi, consider the following: timeit('factor(3^89-1, proof=False)') timeit('factor(3^89-1,proof=True)') timeit('factor(3^89-1, proof=False)') timeit('factor(3^89-1,proof=True)') 5 loops, best of 3: 188 ms per loop 5 loops, best of 3: 195 ms per loop 5 loops, best of 3: 194 ms per loop 5 loops, best of 3: 216 ms per loop I didn't expect an increase... I reset Vmplayer 3.01, used Sage 4.1 with Windows 7 64b. Roland -- 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: http://www.sagemath.org
[sage-support] Re: Notebook running very slowly
Hi William, Sage 4.4. is out. What file do I have to download in order to use it with Vmware player 3.01 and Windows 7 64b? Currently I use Sage 4.1 Thank in advance for your swift reply. Roland On 27 apr, 07:04, William Stein wst...@gmail.com wrote: On Fri, Apr 16, 2010 at 3:01 AM, NCP nennacampbellpl...@googlemail.com wrote: Hi, I've been using Sage, version 4.3, for a while. I'm running it using VMware SunVirtualBoxfrom Windows. Recently the Notebook has slowed down so much that I can hardly use it. VMware !=VirtualBox(you're confused about that above). Anyway, you could try using this new VMware-based Sage install instead: http://wstein.org/home/wstein/binaries/sage-vmware-4.4.alpha0.zip To run it, you need to get the free vmware player from vmware.com. William Recent things I have done are: uploaded a worksheet via Mozilla Firefox which was written on a Mac; installed security updates for Windows on my computer. I've uninstalled the updates but the Notebook is running just as slow. I have also uploaded worksheets in the same way before and had no problem. This worksheet is however larger with a few long calculations on it. I've also tried deleting all other worksheets I'm not using. Could anyone help with what I can do? Thank you, Nenna -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- William Stein Professor of Mathematics University of Washingtonhttp://wstein.org -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- 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: http://www.sagemath.org
[sage-support] Re: Test if a variable is numerical
Hi, Maybe this helps: a=[1,2.3] print isinstance(a,list) True a=67 print isinstance(a,Integer) True Roland On 7 mei, 23:49, Nathann Cohen nathann.co...@gmail.com wrote: Thank you !!! :-) Would there be any way to do the same thing without having to import RR in all of my functions, though ? It's really mainly to distinguish numerical values from different types, so I thought there may be a Python way to do it ... Though it perfectly works like that ! :-) Nathann On 7 May 2010 17:41, Robert Bradshaw rober...@math.washington.edu wrote: Try doing x in RR - Robert On May 7, 2010, at 2:38 PM, Nathann Cohen wrote: Hello everybody !!! I am trying to find out how to check whether some Sage variable is numerical (let's say real, as opposed to None, False, {}, Set([]), etc..), but was not lucky on Google... ^^; Do you know the function I am looking for ? :-) Thank youu !!! Nathann -- 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:http://www.sagemath.org -- 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:http://www.sagemath.org -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- 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: http://www.sagemath.org
[sage-support] Loading ABC triples: How to read *.gz files?
Hi, The site http://abcathome.com/data/ has a link the file triples_sofar.gz, a database with ABC triples. I would like to use the file within Sage. The link is http://abcathome.com/data/triples_sofar.gz The size is around 162Mb; unpacked around 400Mb. Via F = get_remote_file(http://abcathome.com/data/triples_sofar.gz;) I get access to the file. How do I read *.gz files? I'm using VMware 3.01 and Sage version 4.1. Thanks in advance! Roland Related http://groups.google.com/group/sage-support/browse_thread/thread/f253e80b27dea65e/df7f96d14f05701b?lnk=gstq=abc#df7f96d14f05701b -- 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: http://www.sagemath.org
[sage-support] Re: Loading ABC triples: How to read *.gz files?
Dear William, Tnx! I looked at the site http://docs.python.org/release/2.5.2/lib/module-zlib.html, and I tried several options but I could not get a working routine to convert triples_sofar.gz. Could you provide me with a (small) example? Thanks again! Roland On 24 mei, 09:12, William Stein wst...@gmail.com wrote: On Mon, May 24, 2010 at 12:03 AM, Rolandb rola...@planet.nl wrote: Hi, The sitehttp://abcathome.com/data/has a link the file triples_sofar.gz, a database with ABC triples. I would like to use the file within Sage. The link ishttp://abcathome.com/data/triples_sofar.gz The size is around 162Mb; unpacked around 400Mb. Via F = get_remote_file(http://abcathome.com/data/triples_sofar.gz;) I get access to the file. How do I read *.gz files? Seehttp://docs.python.org/release/2.5.2/lib/module-zlib.html I'm using VMware 3.01 and Sage version 4.1. Thanks in advance! Roland Related http://groups.google.com/group/sage-support/browse_thread/thread/f253... -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- William Stein Professor of Mathematics University of Washingtonhttp://wstein.org -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- 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: http://www.sagemath.org
[sage-support] Re: Loading ABC triples: How to read *.gz files?
Tnx! Just for others (and maybe for the manual): import gzip F = get_remote_file(http://abcathome.com/data/triples_sofar.gz;) input_file = gzip.open(F, 'rb') all_data = input_file.read() Roland On 24 mei, 21:58, Jason Grout jason-s...@creativetrax.com wrote: On 05/24/2010 02:36 PM, Rolandb wrote: Dear William, Tnx! I looked at the sitehttp://docs.python.org/release/2.5.2/lib/module-zlib.html, and I tried several options but I could not get a working routine to convert triples_sofar.gz. Could you provide me with a (small) example? Thanks again! Googling for python gzip example gives the following page as the third hit: http://www.doughellmann.com/PyMOTW/gzip/index.html Does that example help? Jason -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- 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: http://www.sagemath.org
[sage-support] MemoryError
Hi, I'm running a routine which uses a large data set (13 million elements). After a while the output is: MemoryError no mem for new parser What to do? Thanks in advance for the swift reply! Roland -- 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: http://www.sagemath.org
[sage-support] Re: MemoryError
Tnx Robert, I rewrote the routine somewhat to use less stored values. Still I got the following message: error: no more memory System -1596988k:2096917k Appl -1763860k/20285k Malloc 277k/0k Valloc -1743852k/20285k Pages 612613/0 Regions 5045:5045 What does this tell me? Roland On 27 mei, 20:41, Robert Bradshaw rober...@math.washington.edu wrote: On May 27, 2010, at 11:31 AM, Rolandb wrote: Hi, I'm running a routine which uses a large data set (13 million elements). After a while the output is: MemoryError no mem for new parser What to do? Thanks in advance for the swift reply! Roland What are you doing with this data? Do you have a sample session? How much memory do you have? How much is it using? It might actually be out of memory. - Robert -- 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: http://www.sagemath.org
[sage-support] Cython and static data
Hi, Using cython, I want to make optimal use of static data. The reason is that lookup is (often) much faster than recalulating. I now use: cdef list nice_list_name=[3 , 3 , 3 , 3 , 3 , 3 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 , et cetera] But this didn't increase the speed. Suggestions are appriciated! Roland -- 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: http://www.sagemath.org
[sage-support] Re: Cython and static data
Tnx! int* did the tric. Maybe an idea to mention this in the Cython manual. Look at the amazing difference in speed sage: timeit('for x in xrange(1,10): is_square(x,True)',number=25) 25 loops, best of 3: 1.35 s per loop sage: timeit('for x in xrange(1,10): c_is_square(x,True)',number=25) 25 loops, best of 3: 37.2 ms per loop The latter is due to a more refined exclusion method as for instance descibed in http://stackoverflow.com/questions/295579/fastest-way-to-determine-if-an-integers-square-root-is-an-integer Roland On 7 jun, 18:15, Robert Bradshaw rober...@math.washington.edu wrote: On Jun 7, 2010, at 8:04 AM, Rolandb wrote: Hi, Using cython, I want to make optimal use of static data. The reason is that lookup is (often) much faster than recalulating. I now use: cdef list nice_list_name=[3 , 3 , 3 , 3 , 3 , 3 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 4 , 5 , 5 , 5 , et cetera] But this didn't increase the speed. Suggestions are appriciated! Perhaps in your case lookup isn't faster than recalculating? If it's about a tie, re-calculating is probably better, as it's less of a black box. Here you're using a Python list of ints, if you really want speed you'd want to use a int*. You could globally calculate this the first time it's used and use a lookup from then on. - Robert -- 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: http://www.sagemath.org
[sage-support] How to do it in cython?
Hi, I have a small (nonsense) example of a program I would like to be able to convert to cython. But I don't know how to convert: R.A,B,C=QQ[], .factor(), .unit() and .factor(proof=False,limit=10^5). I could not find anything in the documentation about for instance handling elements of R.A,B,C=QQ[], thus sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingular. R.A,B,C=QQ[] def test(trio,expr=(A,B,C)): (a,b,c)=sorted(map(lambda x: abs(x(trio)),expr)) basis=prod(expr).factor() te_ontbinden=[abs(w[0](trio)) for w in basis]+[QQ(basis.unit())] radl=abs(prod(uniq([p for g in te_ontbinden for p,_ in ZZ(g).factor(proof=False,limit=10^5)]))) return radl test((1,8,9),(A^2,C^2-A^2,C^2)) 30 Any help is appreciated! Roland -- 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: http://www.sagemath.org
[sage-support] Re: MemoryError
Hi, It took much time but I finally got the following message: File gen.pyx, line 9174, in sage.libs.pari.gen._pari_trap (sage/libs/ pari/gen.c:44241) sage.libs.pari.gen.PariError: not enough memory (48) From Pari I use many times ZZ(pari(test).moebius()). Can this explain the memory error? Roland On 29 mei, 09:43, Robert Bradshaw rober...@math.washington.edu wrote: On May 28, 2010, at 9:53 PM, Rolandb wrote: Tnx Robert, I rewrote the routine somewhat to use less stored values. Still I got the following message: error: no morememory System -1596988k:2096917k Appl -1763860k/20285k Malloc 277k/0k Valloc -1743852k/20285k Pages 612613/0 Regions 5045:5045 What does this tell me? Usually this means exactly what it says, you've used up all thememory on your machine and can't allocate any more. What kind of machine are you running this on? If this is a Virtual Machine, you may be able to increase the amount ofmemoryyou give it, but otherwise you may need to rewrite your code, put more RAM in your machine, or run it on a bigger machine. Without more details it's hard to give advice on how you could rewrite your code, but 13 million real numbers should be easy to handle, 13 million large matrices not so much. Roland On 27 mei, 20:41, Robert Bradshaw rober...@math.washington.edu wrote: On May 27, 2010, at 11:31 AM, Rolandb wrote: Hi, I'm running a routine which uses a large data set (13 million elements). After a while the output is: MemoryError no mem for new parser What to do? Thanks in advance for the swift reply! Roland What are you doing with this data? Do you have a sample session? How muchmemorydo you have? How much is it using? It might actually be out ofmemory. - Robert -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- 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: http://www.sagemath.org
[sage-support] Re: Sage can't find a Python program I wrote
Hi, May I extend the question somewhat. If you look at http://www.sagemath.org/doc/tutorial/programming.html#section-standalone , you find the text: It is also easy to access C functions defined in separate *.c files. Here’s an example. Create files test.c and test.spyx in the same directory with contents: I'm using VMware player + Windows, so I have no direct access to Windows directories. Thus WHERE must I put the files test.c and test.spyx? Roland On 19 jun, 01:32, TianWei ltwis...@gmail.com wrote: I'm learning to use Sage/Python for undergrad research over this summer. I'm running Sage 4.4.2 (binary build) on snow leopard (Mac OS 10.6.3). I wrote an extremely small program in python: import sys from sage.all import * print Hello and called it test.py. It is currently in my sage folder. I type test.py into the command line and get the error: NameError Traceback (most recent call last) /Applications/sage/ipython console in module() NameError: name 'test' is not defined Hi, I'm also a new sage user, but one way to get started is to read: http://www.sagemath.org/doc/tutorial/programming.html#section-standalone To get your script to run, you could type: path to sage executable/sage test.py at any command shell (bash, sh, etc). If you add the sage installation directory to your PATH environment variable, then you could simply call sage test.py. Note that using a .py extension would disable the sage pre-parser, so the expression 2^8 in the script would not be interpreted as exponentiation (as in sage), but as the bitwise-or operator as defined in python (I believe). To run a script using the sage pre-parser, use a .sage extension. There's probably other variations of the same idea here, but I usually use the Sage Notebook, so I don't know much about running external scripts. -- Tianwei. -- 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: http://www.sagemath.org
[sage-support] Why is map using memory?
Hi, Look at: R.A,B,C=QQ[] print get_memory_usage() for i in xrange(1): (an,bn,cn)=map(lambda x: abs(x((1,8,9))), (A,B,C)) print get_memory_usage() 819.94921875 828.94921875 Why is the memory usage increasing with 9Mb? This only happens when map is used repeatedly! I would expect no increase at all. I'm using VMware+Sage 4.1, but I obtaining the same result on sagenb: http://www.sagenb.org/home/pub/2164 Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Re: Why is map using memory?
Hi, I found a more simplified example: print get_memory_usage() for i in xrange(1): A(1,8,9) print get_memory_usage() Why is type(A) 'sage.rings.polynomial.multi_polynomial_libsingular.MPolynomial_libsingu \lar' using memory? Roland On 20 jun, 16:18, Rolandb rola...@planet.nl wrote: Hi, Look at: R.A,B,C=QQ[] print get_memory_usage() for i in xrange(1): (an,bn,cn)=map(lambda x: abs(x((1,8,9))), (A,B,C)) print get_memory_usage() 819.94921875 828.94921875 Why is the memory usage increasing with 9Mb? This only happens when map is used repeatedly! I would expect no increase at all. I'm using VMware+Sage 4.1, but I obtaining the same result on sagenb:http://www.sagenb.org/home/pub/2164 Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Re: Is there any way to get old VMware versions?
Hi Alex, +10 for the person who is willing and able to make a recent VMWare Sage image (x86_64). Since April I rather use VMWare Sage than the Virtualbox version, despite the disadvantages of the old release. VWMare did change a lot; a good reason to support both Virtualbox and VMWare in the future? Hopefully Sage 4.4.4 will include many of the current 132 Tickets needed review ... A new release just before 5 July would be perfect (Sage Days 23 at Leiden). Roland On 22 jun, 06:11, Alex Ghitza aghi...@gmail.com wrote: On Mon, 19 Apr 2010 18:04:13 -0700, William Stein wst...@gmail.com wrote: I have now posted a brand new VMWare Sage-4.4 image: http://boxen.math.washington.edu/home/wstein/binaries/sage-vmware-4.4... It's something I made from scratch using a different approach than before. Please try it out and let me know if it works at all for you. Hi William, I'd like to know what's involved in making a VMWare Sage image like the one you mentioned above (and which is available for download from the Sage web page). I'm asking because we'll have to install Sage in our computer labs (Windows only) and I'd like to use something more recent than 4.4.alpha0. Thanks, Alex -- Alex Ghitza --http://aghitza.org/ Lecturer in Mathematics -- The University of Melbourne -- Australia -- 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: http://www.sagemath.org
[sage-support] Re: tell to sage do something if you can but if you can not, pass to anything else
Hi, I use ZZ(ss).factor(proof=False,limit=10^5). By changing 'limit' you limit the search. 2^26 * 3^30 * 5^15 * 7^5 * 13^5 * 23^2 * 29 * 37 * 967 * 100231435706561580153005984524922236635721822683010490144527758096287118\ 468921220756478157058125901560872523532972896397 This can be combined with a timer. Roland On 19 jul, 17:51, chris wuthrich christian.wuthr...@gmail.com wrote: A related question: is it possible to catch an exception if there is a time out? I think there should be. The timeout process should raise an exception which can be catch. Right now, one can catch that it sends back a string 'NO DATA (timed out)' rather than a result. So the following should do. But that is not the way it should be IMHO. @fork(timeout=1) def mon_factor(n): return factor(n) for m in [randint(10,100) for i in [1..10]]: N = 10^m +127 ff = mon_factor(N) if type(ff) != type('a'): print success : %s%ff else: print no success : %s%ff Chris. -- 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: http://www.sagemath.org
[sage-support] Re: tell to sage do something if you can but if you can not, pass to anything else
Hi, I looked at ticket 9537, and I wondered why not the main part of 9451 was integrated? http://trac.sagemath.org/sage_trac/attachment/ticket/9451/sieve_of_atkin.patch It seems that a combination is far more powerful. Roland On 19 jul, 21:32, William Stein wst...@gmail.com wrote: Hi, On this topic, Sebastian Pancratz and I wrote an optimized implementation of trial division to find the smallest factor of an integer: http://trac.sagemath.org/sage_trac/ticket/9537 This may be in sage-4.5.2. -- William On Mon, Jul 19, 2010 at 9:16 PM, Rolandb rola...@planet.nl wrote: Hi, I use ZZ(ss).factor(proof=False,limit=10^5). By changing 'limit' you limit the search. 2^26 * 3^30 * 5^15 * 7^5 * 13^5 * 23^2 * 29 * 37 * 967 * 100231435706561580153005984524922236635721822683010490144527758096287118\ 468921220756478157058125901560872523532972896397 This can be combined with a timer. Roland On 19 jul, 17:51, chris wuthrich christian.wuthr...@gmail.com wrote: A related question: is it possible to catch an exception if there is a time out? I think there should be. The timeout process should raise an exception which can be catch. Right now, one can catch that it sends back a string 'NO DATA (timed out)' rather than a result. So the following should do. But that is not the way it should be IMHO. @fork(timeout=1) def mon_factor(n): return factor(n) for m in [randint(10,100) for i in [1..10]]: N = 10^m +127 ff = mon_factor(N) if type(ff) != type('a'): print success : %s%ff else: print no success : %s%ff Chris. -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- William Stein Professor of Mathematics University of Washingtonhttp://wstein.org -- 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: http://www.sagemath.org
[sage-support] 4.5.1 or 4.5.2 for win?
Hi, I'm thrilled that a new VMware version is out. But looking at METALINK, I found version 4.5.2 for win while other versions are 4.5.1? See www.sagemath.org/mirror/win/meta/sage-vmware-4.5.2.zip. Roland -- 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: http://www.sagemath.org
[sage-support] China
Hi, Maybe the following is of some interest. Last week, I was in both Beijing and Shanghai. The main webpages www.sagemath.org as well as http://groups.google.com/group/sage-support could be used, but no other Sage webpages! It seems that a potential huge community can't use Sage. Roland -- 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: http://www.sagemath.org
[sage-support] Re: China
On 7 aug, 21:54, William Stein wst...@gmail.com wrote: On Sat, Aug 7, 2010 at 12:47 PM, Rolandb rola...@planet.nl wrote: Hi, Maybe the following is of some interest. Last week, I was in both Beijing and Shanghai. The main webpageswww.sagemath.orgas well as http://groups.google.com/group/sage-supportcould be used, but no other Sage webpages! Why? Is Sage banned in China, just like Google is rumored to be banned? -- William It seems that groups is difficult to reach/use, but that's a guess. I will ask locals whether they can find out the reason, or probably more wisely, a solution. Maybe a virtual copy can be set up. -- Roland It seems that a potential huge community can't use Sage. Roland -- 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 athttp://groups.google.com/group/sage-support URL:http://www.sagemath.org -- William Stein Professor of Mathematics University of Washingtonhttp://wstein.org -- 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: http://www.sagemath.org
[sage-support] Re: 4.5.1 or 4.5.2 for win?
On 8 aug, 01:47, Alex Ghitza aghi...@gmail.com wrote: Hi, On Sat, 7 Aug 2010 12:37:16 -0700 (PDT), Rolandb rola...@planet.nl wrote: I'm thrilled that a new VMware version is out. But looking at METALINK, I found version 4.5.2 for win while other versions are 4.5.1? Seewww.sagemath.org/mirror/win/meta/sage-vmware-4.5.2.zip. Sage 4.5.2 was just released. I had some insider information and obtained the final tar while it was still being tested on some platforms, and built it into vmware. Thus the somewhat unusual situation of sage-vmware-4.5.2 preceeding the official release by half a day or so. So it should be fine to use the sage-vmware-4.5.2 that's up now. Best, Alex There is a (huge) difference between win version 4.5.1 and 4.5.2. In version 4.5.1 an external network was setup, so I can use Sage via Windows Firefox using the address 192.168.236.128. The 4.5.2 version gives the warning that an external network was not setup. Is there an easy way to solve this? Thanks in advance! Roland -- Alex Ghitza --http://aghitza.org/ Lecturer in Mathematics -- The University of Melbourne -- Australia -- 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: http://www.sagemath.org
[sage-support] Bad Gateway
Hi, I used dowload all, and thereafter I tried to upload the file download_worksheets. The following message appears: Bad Gateway The proxy server received an invalid response from an upstream server. Apache/2.2.12 (Ubuntu) Server at 192.168.231.129 Port 80 Any idea how to get the job done? Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Memleak: could this be solved please?
Hi, Memory leaks are annoying. For instance #9298. Could somebody have a look at it? Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Error message
Hi, I get the following message: terminate called after throwing an instance of 'std::runtime_error' what(): /usr/local/sage/local/bin/sage-sage: line 349: 3732 Aborted python $@ VMware, Sage 4.1 Roland -- 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: http://www.sagemath.org
[sage-support] Re: Bad Gateway
On 10 aug, 07:45, Mitesh Patel qed...@gmail.com wrote: On 08/08/2010 05:43 AM, Rolandb wrote: I used dowload all, and thereafter I tried to upload the file download_worksheets. The following message appears: Bad Gateway The proxy server received an invalid response from an upstream server. Apache/2.2.12 (Ubuntu) Server at 192.168.231.129 Port 80 Any idea how to get the job done? Thanks in advance! Could you give more information about your server setup? Where does the message appear? Does uploading download_worksheets.zip work with a notebook server that's not proxied through Apache? That is, if you run, e.g., sage: notebook() visithttp://localhost:8000, click on Upload, etc.? Dear Mitesh, I'm using VMware, Sage 4.5.1., with Firefox. Just used download all in Sage 4.1, and I tried to upload download_worksheets (note: that is the full file name!), size 57Mb. The error appeared at the top of the browser. Roland -- 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: http://www.sagemath.org
[sage-support] VMware memory allocation: how to change it with version 4.5.2?
Hi, VMware is supported again which I appriciate very much. But there is a difference with (for instance) Sage 4.1. With Sage 4.1 I could change the memory allocation via the option VM Settings. With Sage 4.5.2. the allocation is only 512Mb, and can't be changed. Any solution at hand? Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Re: VMware memory allocation: how to change it with version 4.5.2?
On 11 aug, 23:45, Alex Ghitza aghi...@gmail.com wrote: Hi, On Wed, 11 Aug 2010 10:02:03 -0700 (PDT), Rolandb rola...@planet.nl wrote: But there is a difference with (for instance) Sage 4.1. With Sage 4.1 I could change the memory allocation via the option VM Settings. With Sage 4.5.2. the allocation is only 512Mb, and can't be changed. Any solution at hand? Thanks in advance! Here is a little experiment I ran: I just tried to change the RAM allocation for the latest vmware image, and could not. At the top of the corresponding settings window, vmware tells me: Disabled items cannot be changed until the virtual machine is powered off. To make these changes, first resume the virtual machine and then shut it down. In other words, one cannot change the RAM allocation for a virtual machine that is currently running or suspended, but only for machines that are powered off. I powered mine off and was able to change the settings. Best, Alex Tnx Alex! I suggest that the following guideline could be added to the documentation (http://www.sagemath.org/mirror/win/README.txt): * download VMware - please check around every three months whether there is a new WMware version! Currently use version 3.1. * start Sage * If it works correctly, you see three icons: Sage notebook, Sage and Terminal i) Start Sage notebook ii) you will see a web-address message like http://192.168.231.12x/. Remember it! - if you do not see a web-address message, you can use Sage within Ubuntu but you cannot use Sage in Windows Now do some quick tests, mainly to ensure that the system settings are optimal. iii) Open the worksheet Test. Check whether all calculations and graphics work properly and fast(!) - if no reaction: please notify sage-support with all the information about your system, error messages et cetera - if graphics does not show up nicely: install missing software and/or try different screen settings - if Sage is slow, please notify sage-support with all the information about your system iv) Close the worksheet Test, close Sage notebook, close VMplayer v) Open VMplayer directly (search for VMplayer.exe) - You will see the virtual application Sage. - If you point to it, on the left screen you are able to change the memory settings. Go for the max! - start Sage application (nothing else!), and minimize the screen - start your web browser (Firefox 3.6 or better), and use the address 192.168.231.12x - check Test again The Sage world is yours! When a release is made, the above steps should be tested. * The main reason for the extra steps is that VMplayer now allows a different memory allocation per application, but standard is 512MB. If I can contribute further, please let me know. Roland -- Alex Ghitza --http://aghitza.org/ Lecturer in Mathematics -- The University of Melbourne -- Australia -- 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: http://www.sagemath.org
[sage-support] Re: help! windows crash - sage inaccessible from host browser
On 11 aug, 22:36, Josh yoshua.coo...@gmail.com wrote: This is probably completely noobish of me, but I really need help solving the following problem (which has now occurred for the second time). First, the setup: Sage Version 4.3 VirtualBox 3.1.4 Windows 7 Firefox 3.6.8 My machine crashed with the VM running Sage. When I rebooted, I restarted VirtualBox, restarted the VM, and pointed the (host) browser to Sage's IP (192.168.56.101). No dice: I get a Firefox can't establish a connection to the server at 192.168.56.101. Furthermore, pinging 192.168.56.101 from a command prompt gives 4 healthy 1ms responses. Inside the VM, opening Firefox and pointing it tohttp://localhost:8000/home/admin/ initially gave a can't establish connection error. Then I clicked on the sage:prompt icon and typed notebook(). The result was that now the VM browser does display the Active Worksheets page correctly, although Sage threw the following at me: The notebook files are stored in: sage_notebook.sagenb ** * * * Open your web browser tohttp://localhost:8000* * * ** Removing stale pidfile /home/sage/.sage/sage_notebook.sagenb/ twistd.pid 2010-08-11 13:11:24-0700 [-] Log opened. 2010-08-11 13:11:24-0700 [-] twistd 8.2.0 (/sage/sage/local/bin/python 2.6.2) st arting up. 2010-08-11 13:11:24-0700 [-] reactor class: twisted.internet.selectreactor.Selec tReactor. 2010-08-11 13:11:24-0700 [-] twisted.web2.channel.http.HTTPFactory starting on 8 000 2010-08-11 13:11:24-0700 [-] Starting factory twisted.web2.channel.http.HTTPFac tory instance at 0xb752b2c The host browser still does not see 192.168.56.101. Please help! Thanks, Josh Josh, I encountered this problem often so I became frustrated... My advice is to switch immediately to the VMplayer route and do not use Virtualbox anymore. (VMplayer has improved a lot) Look at the download page http://wiki.sagemath.org/DownloadAndInstallationGuide what to do, and follow the instructions at http://groups.google.com/group/sage-support/t/7e82f6dc7b4f5065 Before you switch, do NOT forget to download ALL your worksheet files first! Success! Roland -- 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: http://www.sagemath.org
[sage-support] Finding symbolic solutions
Hi, Some help is appreciated concerning the following. Suppose P1,P2,P3 are two-variate polynomials. I search for all sets of (P1,P2,P3) such that: i) P1(A,B)+P2(A,B)=P3(A,B) ii) Greatest common denominator P1 and P2 equals 1 [Thus gcd( P1, P2 )=1] iii) P1*P2*P3 can be divided by A*B*(A+B) [Thus gcd( P1*P2*P3, A*B*(A+B) )=A*B*(A+B)] The most elementary forms are A + B = A+B, A^2 + B*(A+B) = (A+B)^2 and (B-A)^2 + 4*A*B = (A+B)^2. Somewhat more appealing is the following identity: (A+2*B)*A^3 + B*(2*A +3*B)^3 = (A+B)*(A+3*B)^3 In general, there should be many more of these 'nice' examples. I'm curious if via Sage one could develop a generating algorithm. Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Re: Finding symbolic solutions
On 16 aug, 05:53, Kenny Brown im.self.emplo...@gmail.com wrote: On Aug 13, 3:07 pm, Rolandb rola...@planet.nl wrote: The most elementary forms are A + B = A+B, A^2 + B*(A+B) = (A+B)^2 and (B-A)^2 + 4*A*B = (A+B)^2. You say A + B = A+B. Was that a typo? No. Just follow i,ii and iii with P1(A,B)=A, P2(A,B)=B and P3(A,B)=A +B. I forgot to add that I assumed that gcd(A,B)=1. -- 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: http://www.sagemath.org
[sage-support] Re: Finding symbolic solutions
On 16 aug, 19:44, Rolandb rola...@planet.nl wrote: On 16 aug, 05:53, Kenny Brown im.self.emplo...@gmail.com wrote: On Aug 13, 3:07 pm, Rolandb rola...@planet.nl wrote: The most elementary forms are A + B = A+B, A^2 + B*(A+B) = (A+B)^2 and (B-A)^2 + 4*A*B = (A+B)^2. You say A + B = A+B. Was that a typo? No. Just follow i,ii and iii with P1(A,B)=A, P2(A,B)=B and P3(A,B)=A +B. I forgot to add that I assumed that gcd(A,B)=1. Please note that the above identity is not so commonly known, as Tito Piezas has add it to its collection of Algebraic Identities. I found it using Sage! Hello Roland, The identity has been included in the Aug updates. Thanks. https://sites.google.com/site/tpiezas/updates08 Sincerely, Tito So research ideas are welcome! Roland -- 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: http://www.sagemath.org
[sage-support] Error message
Hi, VMware 3.1.1 with 4.5.1: 2010-08-16 13:01:46-0700 [-] Log opened. 2010-08-16 13:01:46-0700 [-] twistd 9.0.0 (/home/sage/sage/local/bin/ python 2.6.4) starting up. 2010-08-16 13:01:46-0700 [-] reactor class: twisted.internet.selectreactor.SelectReactor. 2010-08-16 13:01:46-0700 [-] twisted.web2.channel.http.HTTPFactory starting on 8000 2010-08-16 13:01:46-0700 [-] Starting factory twisted.web2.channel.http.HTTPFactory instance at 0xad4e0cc (firefox:1942): GLib-WARNING **: g_set_prgname() called multiple times 2010-08-16 23:00:37-0700 [HTTPChannel,142,127.0.0.1] /home/sage/sage/ local/lib/python2.6/site-packages/sagenb-0.8.1-py2.6.egg/sagenb/ notebook/worksheet.py:1936: exceptions.UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal 2010-08-27 12:49:12-0700 [HTTPChannel,742,127.0.0.1] Starting zipping a group of worksheets in a separate thread... 2010-08-27 12:49:14-0700 [-] Exception rendering: 2010-08-27 12:49:14-0700 [-] Unhandled Error Traceback (most recent call last): File /home/sage/sage/local/lib/python/threading.py, line 497, in __bootstrap self.__bootstrap_inner() File /home/sage/sage/local/lib/python/threading.py, line 525, in __bootstrap_inner self.run() File /home/sage/sage/local/lib/python/threading.py, line 477, in run self.__target(*self.__args, **self.__kwargs) --- exception caught here --- File /home/sage/sage/local/lib/python2.6/site-packages/ Twisted-9.0.0-py2.6-linux-i686.egg/twisted/python/threadpool.py, line 210, in _worker result = context.call(ctx, function, *args, **kwargs) File /home/sage/sage/local/lib/python2.6/site-packages/ Twisted-9.0.0-py2.6-linux-i686.egg/twisted/python/context.py, line 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File /home/sage/sage/local/lib/python2.6/site-packages/ Twisted-9.0.0-py2.6-linux-i686.egg/twisted/python/context.py, line 37, in callWithContext return func(*args,**kw) File /home/sage/sage/local/lib/python2.6/site-packages/ sagenb-0.8.1-py2.6.egg/sagenb/notebook/twist.py, line 1448, in f notebook.export_worksheet(worksheet.filename(), sws_filename) File /home/sage/sage/local/lib/python2.6/site-packages/ sagenb-0.8.1-py2.6.egg/sagenb/notebook/notebook.py, line 983, in export_worksheet S.export_worksheet(username, id_number, output_filename, title=title) File /home/sage/sage/local/lib/python2.6/site-packages/ sagenb-0.8.1-py2.6.egg/sagenb/storage/filesystem_storage.py, line 362, in export_worksheet open(worksheet_txt,'w').write(old_heading + open(worksheet_html).read()) exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 8037: ordinal not in range(128) Any idea? Roland -- 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: http://www.sagemath.org
[sage-support] Re: Error message
On 28 aug, 02:31, Mitesh Patel qed...@gmail.com wrote: On 08/27/2010 02:57 PM, Rolandb wrote: VMware 3.1.1 with 4.5.1: 2010-08-16 13:01:46-0700 [-] Log opened. 2010-08-16 13:01:46-0700 [-] twistd 9.0.0 (/home/sage/sage/local/bin/ python 2.6.4) starting up. 2010-08-16 13:01:46-0700 [-] reactor class: twisted.internet.selectreactor.SelectReactor. 2010-08-16 13:01:46-0700 [-] twisted.web2.channel.http.HTTPFactory starting on 8000 2010-08-16 13:01:46-0700 [-] Starting factory twisted.web2.channel.http.HTTPFactory instance at 0xad4e0cc (firefox:1942): GLib-WARNING **: g_set_prgname() called multiple times 2010-08-16 23:00:37-0700 [HTTPChannel,142,127.0.0.1] /home/sage/sage/ local/lib/python2.6/site-packages/sagenb-0.8.1-py2.6.egg/sagenb/ notebook/worksheet.py:1936: exceptions.UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal 2010-08-27 12:49:12-0700 [HTTPChannel,742,127.0.0.1] Starting zipping a group of worksheets in a separate thread... 2010-08-27 12:49:14-0700 [-] Exception rendering: 2010-08-27 12:49:14-0700 [-] Unhandled Error Traceback (most recent call last): File /home/sage/sage/local/lib/python/threading.py, line 497, in __bootstrap self.__bootstrap_inner() File /home/sage/sage/local/lib/python/threading.py, line 525, in __bootstrap_inner self.run() File /home/sage/sage/local/lib/python/threading.py, line 477, in run self.__target(*self.__args, **self.__kwargs) --- exception caught here --- File /home/sage/sage/local/lib/python2.6/site-packages/ Twisted-9.0.0-py2.6-linux-i686.egg/twisted/python/threadpool.py, line 210, in _worker result = context.call(ctx, function, *args, **kwargs) File /home/sage/sage/local/lib/python2.6/site-packages/ Twisted-9.0.0-py2.6-linux-i686.egg/twisted/python/context.py, line 59, in callWithContext return self.currentContext().callWithContext(ctx, func, *args, **kw) File /home/sage/sage/local/lib/python2.6/site-packages/ Twisted-9.0.0-py2.6-linux-i686.egg/twisted/python/context.py, line 37, in callWithContext return func(*args,**kw) File /home/sage/sage/local/lib/python2.6/site-packages/ sagenb-0.8.1-py2.6.egg/sagenb/notebook/twist.py, line 1448, in f notebook.export_worksheet(worksheet.filename(), sws_filename) File /home/sage/sage/local/lib/python2.6/site-packages/ sagenb-0.8.1-py2.6.egg/sagenb/notebook/notebook.py, line 983, in export_worksheet S.export_worksheet(username, id_number, output_filename, title=title) File /home/sage/sage/local/lib/python2.6/site-packages/ sagenb-0.8.1-py2.6.egg/sagenb/storage/filesystem_storage.py, line 362, in export_worksheet open(worksheet_txt,'w').write(old_heading + open(worksheet_html).read()) exceptions.UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 8037: ordinal not in range(128) Any idea? This appears to have happened when you clicked to Download All Active worksheets. Could you try to isolate an individual worksheet that raises this exception by downloading your worksheets individually? I'd start with any worksheets that contain non-ASCII characters in the title or body. Hi Mitesh, I found 2 individual worksheets with a problem. Just copying the text and saving the file worked in 1 case, but with the other worksheet I ran into the Bad Request Maximum length of 102400 bytes exceeded problem. http://groups.google.com/group/sage-support/browse_thread/thread/c814c8cf7bc7dd87 However, the first file is very simple and I didn't use non-ASCII characters. Roland -- 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: http://www.sagemath.org
[sage-support] Re: 4.5.1 or 4.5.2 for win?
On 15 aug, 12:50, jockothy jgmcc...@gmail.com wrote: Hi! There is a (huge) difference between win version 4.5.1 and 4.5.2. In version 4.5.1 an externalnetworkwas setup, so I can use Sage via Windows Firefox using the address 192.168.236.128. The 4.5.2 version gives the warning that an externalnetworkwas not setup. Is there an easy way to solve this? Thanks in advance! Roland I had the same experience. With a bit of Googling I found a solution that worked for me: http://blog.timc3.com/2010/05/04/vmware-ubuntu-ip-address-change/ I ended up with the IP address 192.168.171.128 and a working Sage that I could use via Firefox on the host machine as well as the VM. Hope this helps. Jim Hi Jim, (and others) Version 4.5.3 has the same problem. Could you elucidate somewhat more on what you did exactly. Where did you put the command sudo rm /etc/udev/rules.d/70- persistent-net.rules ? N.B.: I'm using VMware 3.1.1, and I have no knowledge of UNIX Thanks in advance! Roland -- 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: http://www.sagemath.org
[sage-support] Re: 4.5.1 or 4.5.2 for win?
On 9 sep, 22:54, jockothy jgmcc...@gmail.com wrote: On Sep 8, 7:25 pm, Rolandb rola...@planet.nl wrote: Version 4.5.3 has the same problem. Could you elucidate somewhat more on what you did exactly. Where did you put the command sudo rm /etc/udev/rules.d/70- persistent-net.rules ? N.B.: I'm using VMware 3.1.1, and I have no knowledge of UNIX Hi Roland I'm also using VMPlayer 3.1.1, and I have some UNIX knowledge from around 1994! When the Sage VM has started up, there are three icons: Sage Notebook, Sage, Terminal. Double-click the Terminal icon to open a command window; there should be a prompt like s...@ubuntu:~$ and a flashing black cursor. This is where you type the command: sudo rm /etc/udev/rules.d/70-persistent-net.rules then press Enter. It will ask for the password for the sage user; the password is sage, so type it and press Enter. Close the Terminal window. If you now open the Sage Notebook, it may work. I didn't think to try it at this stage. I shut down the VM and restarted it, and everything worked perfectly after that. Good luck! Jim Jim, tnx! After typing the password sage, I got the message rm: cannot remove `/etc/udev/rules.d/70-persistent-net.rules': No such file or directory You had the same? Roland -- 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: http://www.sagemath.org
[sage-support] Re: 4.5.1 or 4.5.2 for win?
On 10 sep, 17:56, HarryK haeckma...@gmx.de wrote: On Aug 8, 9:16 am, Rolandb rola...@planet.nl wrote: On 8 aug, 01:47, Alex Ghitza aghi...@gmail.com wrote: Hi, On Sat, 7 Aug 2010 12:37:16 -0700 (PDT), Rolandb rola...@planet.nl wrote: I'm thrilled that a new VMware version is out. But looking at METALINK, I found version 4.5.2 for win while other versions are 4.5.1? Seewww.sagemath.org/mirror/win/meta/sage-vmware-4.5.2.zip. Sage 4.5.2 was just released. I had some insider information and obtained the final tar while it was still being tested on some platforms, and built it into vmware. Thus the somewhat unusual situation of sage-vmware-4.5.2 preceeding the official release by half a day or so. So it should be fine to use the sage-vmware-4.5.2 that's up now. Best, Alex There is a (huge) difference between win version 4.5.1 and 4.5.2. In version 4.5.1 an external network was setup, so I can use Sage via Windows Firefox using the address 192.168.236.128. The 4.5.2 version gives the warning that an external network was not setup. Is there an easy way to solve this? Thanks in advance! Roland -- Alex Ghitza --http://aghitza.org/ Lecturer in Mathematics -- The University of Melbourne -- Australia Hi, I had the same problem. After starting sage-vmware.vmx I just clicked on VMware Player - Troubleshoot - Reset and this solved the problem. I'm using sage 4.5.3 on VMware player 2.5. Maybe worth a try. Harald Hi, THIS IS THE FINAL TRICK! Tnx! -- 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: http://www.sagemath.org
[sage-support] Solve inconsequent
Hi, Two examples: var('x1,x2') y=[x1,x2] opl=solve([x1^2==4,x2^2==9],y,solution_dict=True) print opl [{x2: -3, x1: -2}, {x2: -3, x1: 2}, {x2: 3, x1: -2}, {x2: 3, x1: 2}] var('x1') y=[x1] opl=solve([x1^2==4],y,solution_dict=True) print opl Traceback (click to the left of this block for traceback) ... TypeError: [x1] is not a valid variable. In both cases y is a list. Roland -- 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: http://www.sagemath.org
[sage-support] Re: solve -- an easy issue with solution_dict=True)
On 13 okt, 03:39, kcrisman kcris...@gmail.com wrote: On Oct 12, 6:37 pm, Robert Samal robert.sa...@gmail.com wrote: I observed that solve behaves inconsistently in the following regards: sage: solve([x==1,x==-1],x) [] (this is as expected) However: solve([x==1,x==-1],x, solution_dict=True) produces an error message. Easy to live with, but I was scared when I first saw it :-). It should be easy to correct, as the message reveals that the function is trying to look at the 0-th element of an empty list ... /data/local/sage/local/lib/python2.6/site-packages/sage/symbolic/ relation.pyc in solve(f, *args, **kwds) 672 sol_list = string_to_list_of_solutions(repr(s)) 673 if 'solution_dict' in kwds and kwds['solution_dict']==True: -- 674 if isinstance(sol_list[0], list): 675 sol_dict=[dict([[eq.left(),eq.right()] for eq in solution]) 676 for solution in sol_list] Yup. solve() probably needs a general overhaul (and has for a while), but no one has had the time to do so. With that in mind, could you open a ticket on the Trac server for this issue and point out the solution? (If you are really ambitious, you can contribute a patch as well!) Thanks! - kcrisman If a Trac ticket is opened, please mention also http://groups.google.com/group/sage-support/browse_thread/thread/732e411e3b01aa1a/8654d892cf327d38?lnk=gstq=roland#8654d892cf327d38 Roland -- 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: http://www.sagemath.org
[sage-support] Python or Sage behavior?
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 documentation does not indicate a loss of a 'generator' once used. Question: Python or Sage behavior? Roland -- 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: http://www.sagemath.org