#13355: Plot fails if a function implicitly needs complex intermediate values
-----------------------------+----------------------------------------------
Reporter: tkluck | Owner: burcin
Type: defect | Status: needs_review
Priority: major | Milestone: sage-5.11
Component: symbolics | Resolution:
Keywords: | Work issues:
Report Upstream: N/A | Reviewers:
Authors: | Merged in:
Dependencies: | Stopgaps:
-----------------------------+----------------------------------------------
Comment (by tkluck):
Thanks for looking at this!
Replying to [comment:9 vdelecroix]:
> I don't understand your example. You define `f` to take complex values,
how do you want to plot it as a real function?
My example was
{{{
sage: plot(abs(f(x)),0,5)
}}}
Note the {{{abs}}}.
Now the point is that
{{{
sage: abs(f(3))
abs(f(3))
sage: float(abs(f(3)))
3.0
}}}
both work, but plotting doesn't:
{{{
plot(abs(f(x)),x,0,10)
verbose 0 (2430: plot.py, generate_plot_points) WARNING: When plotting,
failed to evaluate function at 199 points.
verbose 0 (2430: plot.py, generate_plot_points) Last error message:
'unable to simplify to float approximation'
}}}
The reason is that there is an optimization to use {{{fast_callable}}} for
calculating plot points. The current implementation assumes that all
intermediate values are floats, whereas we can still make a real plot when
the argument to abs is complex. This patch should fix that.
Is this any clearer? It would be great if you could test/review the patch!
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/13355#comment:10>
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/groups/opt_out.