I think the culprit is the "pi" in the srange, which gets Maxima too involved (and maxima as called through sage is slow). This may improve very soon as there is some work being done to shift basic symbolic things like "pi" to a more python-based backend.
Anyway for the moment you can avoid this by declaring your own numeric pi. The fastest I could do this without using "fast_float" was: pts=[]; number_of_points=500 mypi = n(pi) for t1 in srange(0, mypi, n(pi/sqrt(number_of_points))): st1 = sin(t1) ct1 = cos(t1) for t2 in srange(0, 2*mypi, n(2*pi/sqrt(number_of_points))): pts.append((st1*cos(t2), st1*sin(t2), ct1)) show(point3d(pts)) ...taking the sin(t1) and cos(t1) calc out of the inner loop helps a bit as well. That was much faster for me than your original code. I had to use point3d to plot, what version of sage are you using? Cheers, Marshall Hampton On Oct 9, 2:02 pm, Byungchul Cha <[EMAIL PROTECTED]> wrote: > I am using sage for my calc III students. The following short code > produces about 500 points on a sphere. > > pts=[]; number_of_points=500 > for t1 in srange(0, pi, n(pi/sqrt(number_of_points))): > for t2 in srange(0, 2*pi, n(2*pi/sqrt(number_of_points))): > pts.append((sin(t1)*cos(t2), sin(t1)*sin(t2), cos(t1))) > show(point(pts)) > > My question is, though, that sage takes, it seems to me, longer time > to execute this than I would expect. (CPU time: 6.66 s, Wall time: > 48.84 s) Am I making some stupid mistake in the above code, or sage > does something unnecessary, which causes the delay? In my (naive) > point of view, plotting as many as 500 points shouldn't take that long > time... Thanks. --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---