Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Fast plots - How do I do those?

I have no experience with Sage plots so I think I make something wrong. With Maple

plot([seq(Re(exp(I*t*(1-n))*(1+(exp(exp(I*t))-1)/(exp(2*exp(I*t))+1))),n=1..20)],t=0..2*Pi);

takes less than 1 second and it looks perfect.

With Sage (executed at SMC)

f = lambda x,n: (exp(i*x*(1-n))*(1+(exp(exp(i*x))-1)/(exp(2*exp(i*x))+1))).real()
bat = plot(f(x,0), (0,2*pi), color=Color(0,0,0), ymin=-1.6, ymax=1.6)
for n in sxrange(1,20,1):
    bat += plot(f(x,n), (0,2*pi), rgbcolor=(n/2,n/5,n/3), ymin=-1.6, ymax=1.6)
bat

takes longer than the lifespan of Methuselah. How can I speed things up?