x+x works in sage but y+y doesn't!

8 views
Skip to first unread message

sam

unread,
Feb 12, 2008, 5:55:48 PM2/12/08
to sage-newbie
When I type x+x on the notebook cell it gives me 2*x
But if I include any other variables such as y or a then I always get
error saying the variable is not defined
for example I get the following when I try y+y
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/changeme/.sage/sage_notebook/worksheets/admin/10/code/
13.py", line 4, in <module>
y+y
File "/home/changeme/sage-2.10/local/lib/python2.5/site-packages/
sympy/plotting/", line 1, in <module>

NameError: name 'y' is not defined

But if I choose maxima in the worksheet then it works fine. Can
someone please explain how to do this in sage please?

Ted Kosan

unread,
Feb 12, 2008, 5:59:54 PM2/12/08
to sage-...@googlegroups.com
Sam,

There is a section in the Sage Newbies book called "Symbolic
Variables" which discusses this :-)

Ted

sam

unread,
Feb 12, 2008, 6:18:29 PM2/12/08
to sage-newbie
Thanks Ted,
It is terrific to get such a fast response! One look at the Newbie
book and I am done!
Just declaring the variables (eg var('y')) solves the problem!
Next time I will look at the book before posting!

Thanks again!

Hector Villafuerte

unread,
Feb 12, 2008, 6:27:38 PM2/12/08
to sage-...@googlegroups.com
Hi,
Something that has helped me before is to use SAGE's Google Custom Search:

http://www.google.com/coop/cse?cx=002411183662849495023:ymym1qazpm4

Or just take the upper-right corner link at http://sagemath.org/
Best,
--
Hector

Reply all
Reply to author
Forward
0 new messages