ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 27 Oct 2011 16:57:58 +02002D plot performancehttps://ask.sagemath.org/question/8420/2d-plot-performance/I have this function
sage: f=imag(I*(sqrt(-cos(l) + 1)*cosh(sin(1/2*l)) -
sqrt(2)*sinh(sqrt(sin(1/2*l)^2)))*sin(1/2*l)^3/((-cos(l)
+ 1)^(3/2)*e^(1/2*I*l)))
i.m.h.o. this not something terribly complicated. I wanted to plot it. So I do
sage: time plot(f,l,0,10)
..nice plot..
Time: CPU 9.28 s, Wall: 9.41 s
**I.e. I was waiting almost 10s** for this (on an intel core duo CPU P9500 @ 2.53GHz) laptop!? I thought that maybe `fast_callable` would help:
sage: ff=fast_callable(f,vars=[l],domain=CC)
sage: time plot(ff,0,10)
..same nice plot..
Time: CPU 13.24 s, Wall: 13.50 s
So that's even worse.
Now I compare to *Mathematica*
In[8]:= Timing[Plot[Im[(Sin[l/2]^3*(I*Sqrt[1 - Cos[l]]*Cosh[Sin[l/2]] -
I*Sqrt[2]*Sinh[Sqrt[Sin[l/2]^2]]))/(E^((I/2)*l)*(1 -
Cos[l])^(3/2))], {l, 0, 10}]]
Out[8]= {0.019997, ..same plot again..}
**~500 times faster** ... what am I doing wrong?XaverThu, 27 Oct 2011 16:57:58 +0200https://ask.sagemath.org/question/8420/