home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 2 / DATAFILE_PDCD2.iso / fractals / _fractrace / FTS-Files / MandelPot < prev    next >
Encoding:
Text File  |  1990-07-22  |  456 b   |  25 lines

  1. \ MandelPot
  2. \ Calculates the M-potential of a complex number
  3. \ stored in creal,cimag
  4.               
  5. var creal, cimag, zreal, zimag, ztemp
  6. var iter, potential
  7.  
  8. creal=0; cimag=1.01
  9. zreal=0; zimag=0; iter=0
  10.  
  11. repeat   
  12.  ztemp=zreal
  13.  zreal=zreal*zreal-zimag*zimag+creal
  14.  zimag=2*ztemp*zimag+cimag
  15.  iter=iter+1
  16. until zreal*zreal+zimag*zimag>4 OR iter>127
  17.  
  18. if iter<=127
  19.  potential=0.5*LOG(zreal*zreal+zimag*zimag)/(2^iter)
  20. else
  21.  potential=0
  22. endif
  23.  
  24. show potential
  25.