#4677: Plotting lambda functions
----------------------+-----------------------------------------------------
Reporter: kcrisman | Owner: was
Type: defect | Status: new
Priority: minor | Milestone: sage-3.2.2
Component: graphics | Keywords:
----------------------+-----------------------------------------------------
This works:
{{{
sage: f=x^2
sage: plot(lambda x:f(x),(x,-1,1))
}}}
But this doesn't:
{{{
sage: f=x^2
sage: plot(lambda x:f,(x,-1,1))
verbose 0 (3633: plot.py, _plot) WARNING: When plotting, failed to
evaluate function at 400 points.
verbose 0 (3633: plot.py, _plot) Last error message: 'float() argument
must be a string or a number'
}}}
The behavior is the same for f(x)=x^2.
This is because in the second example "evaluating" the lambda function
yields a SymbolicCallableExpression, which needs to be called again to
actually yield a numerical value.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4677>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---