Hector Villafuerte wrote:
> Hi,
> this just happened to me (maybe because I'm annoyingly slow today...):
> 
> sage: var('t')
> sage: x(t) = sin(2*pi*1000*t) + 1/2*sin(2*pi*2000*t + 3/4*pi)
> 
> Exception (click to the left for traceback):
> ...
> TypeError: unsupported operand parent(s) for '*': 'Integer Ring' and
> '<class 'sage.plot.plot.Graphics'>'
> 
> 
> 
> It took me about 10 minutes to finally get that I had previously named
> a plot as 'pi'! I had shot myself on the foot...
> 
> sage: pi = list_plot(Xi, pointsize='40', rgbcolor=hue(1), faceted=True)
> 
> 
> So the question: shouldn't constants like pi, e, etc., be treated as
> reserved words in SAGE?
> Best,


What does "reserved words" mean?  Do you mean that we should throw an 
error when those variables are assigned?  I don't think that would be 
possible without some deep tinkering in python.

In mathematica, IIRC, you have separate namespaces (separated by a 
backtick, for example, System`Pi), but also the convention that any 
system name starts with an uppercase letter (and is also in titlecase). 
  This convention makes it very consistent and easy to guess names of 
things as well as makes it very easy to avoid stomping on system names 
(just start all of your variables with lowercase letters). In python, 
that probably wouldn't be possible since the convention is to have 
lowercase functions and titlecase classes.  However, I suppose you could 
always call sage.functions.constants.pi and get the "real" pi.  That's 
how namespaces work in python, if I understand things correctly.

I would absolutely love to have some convention to the names for 
everything in Sage so that I could tell if something was a system name 
by just looking at it.  That's been one of the most irritating thorns in 
switching from Mathematica---I'm constantly nervous that I'm overriding 
some builtin constant or function.  As another option, though, how about 
having the S or Sage namespace include all of the global namespace (at 
least the default global namespace), so that S.pi (or Sage.pi) would 
always refer to the sage system pi (as opposed to having to find that pi 
is sage.functions.constants.pi).

There is a way to reset all system variables back to their defaults.  I 
don't remember how to do it, though.

Jason



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to