#7482: provide a mode so that undeclared variables magically spring into 
existence
and object oriented notation is not necessary
---------------------------+------------------------------------------------
   Reporter:  was          |       Owner:  tbd     
       Type:  enhancement  |      Status:  new     
   Priority:  major        |   Milestone:  sage-4.3
  Component:  misc         |    Keywords:          
Work_issues:               |      Author:          
   Reviewer:               |      Merged:          
---------------------------+------------------------------------------------

Comment(by was):

 Here is a session (to be used in the notebook) that illustrates
 automatic_names:
 {{{
 sage: automatic_names(True)
 sage: x + y + z + wxy
 wxy + x + y + z
 sage: y(y=10)
 10
 sage: type(y)
 <class 'sagenb.misc.support.AutomaticVariable'>
 sage: trig_expand((2*x + 4*y + sin(2*theta))^2)
 4*(sin(theta)*cos(theta) + x + 2*y)^2
 sage: type(trig_expand)
 <class 'sagenb.misc.support.AutomaticVariable'>
 sage: type(x)
 <type 'sage.symbolic.expression.Expression'>
 sage: type(y)
 <class 'sagenb.misc.support.AutomaticVariable'>
 }}}

 Notice above that trig_expand, y, and theta were all automatically
 created.  Notice that substitution {{{y(y=10)}}} still works.   If an
 object obj had a y method, then y(obj) would be evaluated as obj.y().

 Here's a test showing that we avoid infinite loops:
 {{{
 sage: raise NameError
 Traceback (most recent call last):
 ...
 NameError
 sage: raise NameError, "'var'"
 Traceback (most recent call last):
 ...
 NameError: Too many automatic variable names and functions created
 (limit=10000)
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7482#comment:3>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

--

You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=.


Reply via email to