Ask Your Question

Revision history [back]

Hi,

The mess comes from the conjunction of the method _plot_fast_callable (which create a fast evaluation version of your symbolic function) and sage.plot.plot.generate_plot_points (which actually evaluate the function at some points). Taking your notation

sage: fs = abs((exp1-exp2).subs(omega=2**4,omega_n=0))
sage: ffc = fs._plot_fast_callable()    # this used internally when doing plot(fs, ...)
sage: sage.plot.plot.generate_plot_points(ffc, (0,1), plot_points=5)
[(0.0025, 0.0),
 (0.2734882069985261, 0.0),
 (0.3826944564983164, 0.0),
 (0.4097567481781129, 0.0),
 (0.4368190398579094, 0.03143252012240971),
 (0.4909436232175024, 0.030322174131774005),
 (0.5991927899366885, 0.027848144066936354),
 (0.8156911233750606, 0.022234674748898026),
 (1.0, 0.017253323432106536)]

A workaround is to do yourself the fast callable step::

sage: ffc2 = fast_callable(fs, domain=CC, vars=[eta])
sage: sage.plot.plot.generate_plot_points(ffc2, (0,1), plot_points=6)
[(0.15610206187034426, 0.035375246817379545),
 (0.44301929314962857, 0.03131017699174559),
 (0.6601550660647182, 0.026335779049672842),
 (0.7019017926530642, 0.025262664135765032),
 (1.0, 0.017253323432106536)]

I will not track much further the bug but I hope it helped.

Vincent