-
-
Notifications
You must be signed in to change notification settings - Fork 673
Open
Description
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.
Component: graphics
Issue created by migration from https://trac.sagemath.org/ticket/4677