BooleanPolynomialRing in standalone python script

26 views
Skip to first unread message

Prakash Dey

unread,
Mar 17, 2014, 1:14:43 AM3/17/14
to sage-s...@googlegroups.com
Hii All,

I am facing the following problem--------------

The following works fine in sage terminal

sage: R.<a,b,c>=BooleanPolynomialRing(3)
sage: (a+b+c)*(a+b)
a*c + a + b*c + b

but when i want to run the file test.sage
#/usr/bin/sage -python
R.<a,b,c>=BooleanPolynomialRing(3)
print (a+b+c)*(a+b)

the following error message is generated

 File "./pbr.sage", line 5
    R.<x, y, z>=BooleanPolynomialRing(3)
      ^
SyntaxError: invalid syntax

what i am doing wrong?

Nils Bruin

unread,
Mar 17, 2014, 2:11:18 AM3/17/14
to sage-s...@googlegroups.com
On Sunday, March 16, 2014 10:14:43 PM UTC-7, Prakash Dey wrote:
but when i want to run the file test.sage
#/usr/bin/sage -python
R.<a,b,c>=BooleanPolynomialRing(3)
print (a+b+c)*(a+b)

Don't put the "-python" there. You want this file to be run through sage's preprocessor. So keep the ".sage" extension to the file and make the header
#/usr/bin/sage
Reply all
Reply to author
Forward
0 new messages