First time here? Check out the FAQ!

Ask Your Question
1

Standalone Python/Sage Scripts

asked 8 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 8 years ago

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')"
Preview: (hide)
link

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: 8 years ago

Seen: 1,095 times

Last updated: Jun 07 '16