#10246: Can't get symbol from callable function x |--> x
-------------------------+--------------------------------------------------
   Reporter:  kcrisman   |       Owner:  burcin    
       Type:  defect     |      Status:  new       
   Priority:  major      |   Milestone:  sage-4.6.1
  Component:  symbolics  |    Keywords:  plot      
     Author:             |    Upstream:  N/A       
   Reviewer:             |      Merged:            
Work_issues:             |  
-------------------------+--------------------------------------------------
 From [http://ask.sagemath.org/question/198/plotting-x-free-variable-error
 this] ask.sagemath question:

 {{{
 I was plotting sin(x)/x and also wanted a seperate plot of sin(x) and x so
 I could visualize those components as well. However I get an error when
 plotting x saying "free variable x -> x". If I add a coefficient to h(x)
 such as h(x) = 1.0001*x then it works fine.

 This is the code I am using:

 f(x) = sin(x)/x
 g(x) = sin(x)
 h(x) = x

 fig1 = plot(f,-10,10,rgbcolor='green')
 fig2 = plot(g,-10,10,rgbcolor='purple')
 fig3 = plot(h,-10,10,rgbcolor='red')

 figure = fig1 + fig2 + fig3
 show(figure,xmin=-10,xmax=10,ymin=-10,ymax=10,figsize=[8,8],fontsize=20)
 }}}

 The underlying problem is
 {{{
 The exception arises in
 `sage.symbolic.expression_conversions.FastFloatConverter.symbol`:

             try:
                 return self.ff.fast_float_constant(float(ex))
             except TypeError:
                 raise ValueError, "free variable: %s" % repr(ex)

 so that it assumes if a callable expression doesn't have the variable, it
 must be a constant.  However, it before this asks for `if name in vars`
 and `if name in svars`, but here the `name` is `'x |--> x'`.

 So what we need to do is fix it so that if the operator is `None` in the
 previous traceback in your error message, we check for this case
 explicitly, where the name isn't just one of the variables.
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/10246>
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].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to