On Sep 21, 7:09 am, Stan Schymanski <schym...@gmail.com> wrote:
> sage: var('T_a')
> or
> sage: T_a = var('T_a')
>
> but William's example does not work if I do
> sage: var2('T_a', 'Air temperature (K)')
> ??

You're well underway with the question-marks, but instead of writing
them on a separate line in an email you should type them after the
relevant command in sage [this is just to bring the thread back to the
original topic], i.e.,

sage: var??

gets you the source code. The line "G = globals()" should tip you off.
Enter "globals()" in Sage to get some idea what it is meddling with.
In this case, the help text is already helpful too. From "var?":
    ...
      Note: The new variable is both returned and automatically
injected into
         the global namespace. If you need symbolic variable in
library
         code, it is better to use either SR.var() or SR.symbol().
    ...
That's just an odd feature of the top-level "var" which is convenient
for interactive use, but unfortunately always leads to confusion later
on. It also contributes a lot to the misunderstanding about the
relation between python-level identifiers and symbolic variables.
After "var('x')",  the "x" you type is not the same as the "x" that
gets printed. One is a python identifier, the other is a
"SymbolicExpression" instance that happens to print as "x".

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to