#8423: fractals: add code to plot julia sets
---------------------------+------------------------------------------------
   Reporter:  was          |       Owner:  sdietzel  
       Type:  enhancement  |      Status:  new       
   Priority:  minor        |   Milestone:  sage-4.3.4
  Component:  fractals     |    Keywords:            
     Author:               |    Upstream:  N/A       
   Reviewer:               |      Merged:            
Work_issues:               |  
---------------------------+------------------------------------------------

Comment(by mhampton):

 Here's an iterated function system example (the fern):
 {{{
 def fern(x,y):
     """
     An iterated function system whose orbit traces out
     a fern shape.

     INPUT:
         x,y - numerical scalars

     OUTPUT:
         a 2-component list of new x and y values.
     """
     r = random()
     if r<.01:
         return [0,.16*y]
     elif r < .08:
         return [.2*x-.26*y, .23*x+.22*y+1.6]
     elif r < .15:
         return [-.15*x+.28*y, .26*x+.24*y+.44]
     else:
         return [.85*x+.04*y,-.04*x+.85*y+1.6]
 def fern_orbit(n):
     """
     Returns a trajectory of length n of the fern
     iterated function system.

     INPUT:
         n - an integer, the length of the trajectory

     OUTPUT:
         a list of 2-component lists

     EXAMPLE:
        sage: show(points(fern_orbit(10000),pointsize=1),axes=False)
     """
     traj = [[0,0]]
     for i in range(n):
         nt = fern(traj[-1][0],traj[-1][1])
         traj.append(nt)
     return traj
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/8423#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en.

Reply via email to