We've been having a short discussion on sage-support about the issue of
f(x) = sin(x) injecting the variable x into the global namespace (see
http://groups.google.com/group/sage-support/browse_thread/thread/2007c6d474f347ba
). Basically, this was confusing to someone (and to me):
sage: x=CC['x'].gen()
sage: type(x)
<class
'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_dense_field'>
sage: f(x)=sin(x)
sage: type(x)
<class 'sage.calculus.calculus.SymbolicVariable'>
The problem is:
sage: preparse('f(x)=sin(x)')
'_=var("x");f=symbolic_expression(sin(x)).function(x)'
However, mathematical convention says that x is a dummy variable, and so
there should be no difference between f(x) = sin(x) and f(y)=sin(y).
However, currently, each tramples on different parts of the global
namespace.
I think the preparser ought to return
sage: preparse('f(x)=sin(x)')
'_=sage.calculus.calculus.var("x");f=symbolic_expression(sin(_)).function(_)'
sage: f
x |--> sin(x)
(where "_" should be a temporary variable). This way the global
namespace is not affected by what conventionally is a dummy variable.
Simon pointed out that there is precedence for injecting variables that
appear on the left side of an equals sign, using "R.<x> = QQ[]" as an
example.
Any comments or thoughts?
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-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---