Robert Bradshaw wrote:
> On Dec 3, 2008, at 10:28 AM, adrian wrote:
> 
>> In the following code:
>> sage: x=CC['x'].gen()
>> sage: type(x)
>> <class
>> 'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_d 
>> ense_field'>
>> sage: f(x)=sin(x)
>> sage: type(x)
>> <class 'sage.calculus.calculus.SymbolicVariable'>
>>
>> Is this intended?
> 
> Yes. Otherwise one would need to write var('x') before writing f(x) =  
> sin(x).

Wow, Sage will redefine symbols that are already existing to accommodate 
what should be a dummy variable?  This looks seriously wrong and looks 
like it could really mess things up.

For example:

sage: f(sage) = sin(sage)
sage: type(sage)
<class 'sage.calculus.calculus.SymbolicVariable'>

sage: f(i) = i^2
sage: type(i)
<class 'sage.calculus.calculus.SymbolicVariable'>
sage: i^2
i^2

I would strongly prefer that this is wrapped so that a local symbolic 
variable is used that is not tied to anything, or even just so that the 
value of x is reset after the function is assigned.  Are we using 
sage.calculus.calculus.var in the code so that we don't inject into the 
global namespace, just like the docstring of var says?

Jason


--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
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