Processing math: 100%
Ask Your Question
0

Which variables are automagically defined in the sage shell?

asked 12 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 12 years ago

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 x21=0, ZZ to be the integers, and some other things - and of course lots and lots of functions.

Preview: (hide)
link

Comments

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

kcrisman gravatar imagekcrisman ( 12 years ago )

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

Thomas gravatar imageThomas ( 12 years ago )
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 ( 12 years ago )

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

Seen: 303 times

Last updated: Jan 03 '13