Ask Your Question
0

Which variables are automagically defined in the sage shell?

asked 2013-01-03 08:21:01 +0100

Thomas gravatar image

I'm using the sage-5.5 command line and some variables are automatically declared. For instance I can do

f = x^2

but not

f = t^2

My question: How does this come about? Which variables are defined like this? Where is this documented?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2013-01-03 08:47:58 +0100

kcrisman gravatar image

See sage/all.py and sage/all_cmdline.py in the devel/sage directory. In addition to x, we define oo to be infinity, e to be the base of the natural log, i to be a certain root of $x^2-1=0$, ZZ to be the integers, and some other things - and of course lots and lots of functions.

edit flag offensive delete link more

Comments

You could also do `globals()` to find everything at all, but I don't think that is what you meant.

kcrisman gravatar imagekcrisman ( 2013-01-03 08:49:09 +0100 )edit

Interesting effect: Type "globals()" in a session where you have done 'a few' plots before.

Thomas gravatar imageThomas ( 2013-01-03 09:37:50 +0100 )edit
1

First I was not convinced since in sage/all.py the line defining x is commented out (both, in your linked version and in the file on my disk), but then I saw that it comes from the line "from sage.calculus.predefined import x" in all_cmdline.py. Thanks.

Thomas gravatar imageThomas ( 2013-01-03 09:42:17 +0100 )edit

Your Answer

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

Add Answer

Question Tools

Stats

Asked: 2013-01-03 08:21:01 +0100

Seen: 288 times

Last updated: Jan 03 '13