Simon, et al., The script is working for you but not for me. The answer you get for the variety is
{y: 5, z: 7, u: 5, x: 1} {y: 7, z: 8, u: 6, x: 3} {y: 8, z: 1, u: 5, x: 3} {y: 2, z: 5, u: 4, x: 4} This is correct, which is why you see zeros. But when I run the script, the answer I get for the variety is {y: 5, z: 7, u: 5, x: 1} {y: 7, z: 8, u: 6, x: 3} {y: 8, z: 1, u: 5, x: 3} {y: 2, z: 5, u: 4, x: 4} {y: 13, z: -72, u: -7, x: 4} # Bad {y: 10, z: -28, u: 0, x: 1} # Bad Here's a bad output line that I see when I run the script: z^2 - 849/91*z - 30/13*y - 48/91*x + 2582/91({y: 13, z: -72, u: -7, x: 4}): 5852 I ran my script using the following console command line: j...@stroomer-imac-2 ~/grobner_experiments $ sage bugcase.sage Here's my sage version: $ sage --version Sage Version 4.1.1, Release Date: 2009-08-14 I am running on an iMac, OS X 10.6.2, 2.16 Intel Core 2 Duo. Jeff On Jan 18, 1:47 am, William Stein <wst...@gmail.com> wrote: > On Mon, Jan 18, 2010 at 12:32 AM, Minh Nguyen <nguyenmi...@gmail.com> wrote: > > Hi Jeff, > > > On Mon, Jan 18, 2010 at 3:27 PM, Jeff Stroomer <jstroom...@hotmail.com> > > wrote: > > > <SNIP> > > >> #! /usr/bin/env sage > > > This line caught my attention. Is your code meant to be put in a > > separate Python script (with extension ".py") or in a Sage script > > (with extension ".sage")? For example, I created a Python script with > > your code and gave it execute permission: > > > [mv...@mod mvngu]$ ls -g variety.py > > -rwxr-xr-x 1 mvngu 579 2010-01-18 00:20 variety.py > > [mv...@mod mvngu]$ cat variety.py > > #! /usr/bin/env sage > > > import sys, os > > from sage.all import * > > > R = PolynomialRing(QQ, 4, names = 'u,z,y,x', order = 'lex') > > u,z,y,x = R.gens() > > > G = [ > > x^2 + 6/91*z + 6/13*y - 409/91*x + 66/91, > > y*x - 6/91*z - 45/13*y - 410/91*x + 1572/91, > > y^2 + 66/91*z - 129/13*y - 222/91*x + 2000/91, > > z*x - 277/91*z - 4/13*y - 607/91*x + 2049/91, > > z*y - 53/7*z - 5*y - 12/7*x + 313/7, > > z^2 - 849/91*z - 30/13*y - 48/91*x + 2582/91, > > u - 17/91*z - 4/13*y - 9/91*x - 187/91, > > ] > > > I = ideal(G) > > V = I.variety() > > > for v in V: > > print v > > for g in G: > > print ' %s(%s): %s' % (g, v, g.subs(v)) > > > Running it as a Python script doesn't work: > > > [mv...@mod mvngu]$ sage -python variety.py > > Traceback (most recent call last): > > File "variety.py", line 10, in <module> > > x^2 + 6/91*z + 6/13*y - 409/91*x + 66/91, > > File "element.pyx", line 532, in > > sage.structure.element.Element.__xor__ (sage/structure/element.c:4528) > > RuntimeError: Use ** for exponentiation, not '^', which means xor > > in Python, and has the wrong precedence. > > [mv...@mod mvngu]$ sage variety.py > > Traceback (most recent call last): > > File "variety.py", line 10, in <module> > > x^2 + 6/91*z + 6/13*y - 409/91*x + 66/91, > > File "element.pyx", line 532, in > > sage.structure.element.Element.__xor__ (sage/structure/element.c:4528) > > RuntimeError: Use ** for exponentiation, not '^', which means xor > > in Python, and has the wrong precedence. > > > Now I renamed "variety.py" to "variety.sage" (with same code, but > > different file extension). Running "variety.sage" as a Sage script > > works fine with Sage 4.3: > > > [mv...@mod mvngu]$ cat variety.sage > > #! /usr/bin/env sage > > > import sys, os > > from sage.all import * > > > R = PolynomialRing(QQ, 4, names = 'u,z,y,x', order = 'lex') > > u,z,y,x = R.gens() > > > G = [ > > x^2 + 6/91*z + 6/13*y - 409/91*x + 66/91, > > y*x - 6/91*z - 45/13*y - 410/91*x + 1572/91, > > y^2 + 66/91*z - 129/13*y - 222/91*x + 2000/91, > > z*x - 277/91*z - 4/13*y - 607/91*x + 2049/91, > > z*y - 53/7*z - 5*y - 12/7*x + 313/7, > > z^2 - 849/91*z - 30/13*y - 48/91*x + 2582/91, > > u - 17/91*z - 4/13*y - 9/91*x - 187/91, > > ] > > > I = ideal(G) > > V = I.variety() > > > for v in V: > > print v > > for g in G: > > print ' %s(%s): %s' % (g, v, g.subs(v)) > > > [mv...@mod mvngu]$ sage variety.sage > > The whole point of putting > > #! /usr/bin/env sage > > at the top of the file is so that one can type > > [mv...@mod mvngu]$ ./variety.sage > > after say doing > > [mv...@mod mvngu]$ chmod +x variety.sage > > William > > > > > {y: 5, z: 7, u: 5, x: 1} > > 6/91*z + 6/13*y + x^2 - 409/91*x + 66/91({y: 5, z: 7, u: 5, x: 1}): 0 > > -6/91*z + y*x - 45/13*y - 410/91*x + 1572/91({y: 5, z: 7, u: 5, x: 1}): 0 > > 66/91*z + y^2 - 129/13*y - 222/91*x + 2000/91({y: 5, z: 7, u: 5, x: 1}): 0 > > z*x - 277/91*z - 4/13*y - 607/91*x + 2049/91({y: 5, z: 7, u: 5, x: 1}): 0 > > z*y - 53/7*z - 5*y - 12/7*x + 313/7({y: 5, z: 7, u: 5, x: 1}): 0 > > z^2 - 849/91*z - 30/13*y - 48/91*x + 2582/91({y: 5, z: 7, u: 5, x: 1}): 0 > > u - 17/91*z - 4/13*y - 9/91*x - 187/91({y: 5, z: 7, u: 5, x: 1}): 0 > > {y: 7, z: 8, u: 6, x: 3} > > 6/91*z + 6/13*y + x^2 - 409/91*x + 66/91({y: 7, z: 8, u: 6, x: 3}): 0 > > -6/91*z + y*x - 45/13*y - 410/91*x + 1572/91({y: 7, z: 8, u: 6, x: 3}): 0 > > 66/91*z + y^2 - 129/13*y - 222/91*x + 2000/91({y: 7, z: 8, u: 6, x: 3}): 0 > > z*x - 277/91*z - 4/13*y - 607/91*x + 2049/91({y: 7, z: 8, u: 6, x: 3}): 0 > > z*y - 53/7*z - 5*y - 12/7*x + 313/7({y: 7, z: 8, u: 6, x: 3}): 0 > > z^2 - 849/91*z - 30/13*y - 48/91*x + 2582/91({y: 7, z: 8, u: 6, x: 3}): 0 > > u - 17/91*z - 4/13*y - 9/91*x - 187/91({y: 7, z: 8, u: 6, x: 3}): 0 > > {y: 8, z: 1, u: 5, x: 3} > > 6/91*z + 6/13*y + x^2 - 409/91*x + 66/91({y: 8, z: 1, u: 5, x: 3}): 0 > > -6/91*z + y*x - 45/13*y - 410/91*x + 1572/91({y: 8, z: 1, u: 5, x: 3}): 0 > > 66/91*z + y^2 - 129/13*y - 222/91*x + 2000/91({y: 8, z: 1, u: 5, x: 3}): 0 > > z*x - 277/91*z - 4/13*y - 607/91*x + 2049/91({y: 8, z: 1, u: 5, x: 3}): 0 > > z*y - 53/7*z - 5*y - 12/7*x + 313/7({y: 8, z: 1, u: 5, x: 3}): 0 > > z^2 - 849/91*z - 30/13*y - 48/91*x + 2582/91({y: 8, z: 1, u: 5, x: 3}): 0 > > u - 17/91*z - 4/13*y - 9/91*x - 187/91({y: 8, z: 1, u: 5, x: 3}): 0 > > {y: 2, z: 5, u: 4, x: 4} > > 6/91*z + 6/13*y + x^2 - 409/91*x + 66/91({y: 2, z: 5, u: 4, x: 4}): 0 > > -6/91*z + y*x - 45/13*y - 410/91*x + 1572/91({y: 2, z: 5, u: 4, x: 4}): 0 > > 66/91*z + y^2 - 129/13*y - 222/91*x + 2000/91({y: 2, z: 5, u: 4, x: 4}): 0 > > z*x - 277/91*z - 4/13*y - 607/91*x + 2049/91({y: 2, z: 5, u: 4, x: 4}): 0 > > z*y - 53/7*z - 5*y - 12/7*x + 313/7({y: 2, z: 5, u: 4, x: 4}): 0 > > z^2 - 849/91*z - 30/13*y - 48/91*x + 2582/91({y: 2, z: 5, u: 4, x: 4}): 0 > > u - 17/91*z - 4/13*y - 9/91*x - 187/91({y: 2, z: 5, u: 4, x: 4}): 0 > > > -- > > Regards > > Minh Van Nguyen > > > -- > > 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 > Associate 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