Ask Your Question
1

Standalone Python/Sage Scripts

asked 2016-06-07 09:29:42 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

The tutorial example from

http://doc.sagemath.org/html/en/tutor...

is working only for integers. It does not work for symbolic expressions. It becomes working by renaming the script from "factor" to "factor.sage" and replacing the last line by

print factor(sage_eval(sys.argv[1],locals={'x':x}))

Is there anything wrong in my configuration of Sage?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2016-06-07 10:01:24 +0100

tmonteil gravatar image

I got the same, it seems indeed that the symbol x is not injected into the global namespace, but the following works:

./factor "sage.calculus.var.SR.symbol('x')^2+3*sage.calculus.var.SR.symbol('x')"
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-06-07 09:29:42 +0100

Seen: 991 times

Last updated: Jun 07 '16