I written a routine to draw butterfly curves and it works well, except
that it runs very slowly. Can anyone give me some suggestions that
will speed this routine up? While the routine is running there is a
process named "lisp.run" that is using all of the CPU time; hopefully
this will be a hint to someone.

Thanks!

Here is the code:

g = Graphics()
x1, y1 = 0, 0
for theta in srange( 0, 10*pi, 0.01 ):
    r = e^(cos(theta)) - 2*cos(4*theta) + sin(theta/12)^5

    x = r * cos(theta)  # Convert polar to rectangular coordinates
    y = r * sin(theta)

    xx = x*6 + 25       # Scale factors to enlarge and center the
curve.
    yy = y*6 + 25

    if theta != 0:
        l = line( [(x1, y1), (xx, yy)], rgbcolor=hue(theta/7 + 4) )
        g = g + l
    x1, y1 = xx, yy

g.show(dpi=200, axes=False)
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to