home *** CD-ROM | disk | FTP | other *** search
/ Hot Shareware 32 / hot34.iso / ficheros / DGRAF / FRAIN196.ZIP / PHCTUTOR.FRM < prev    next >
Text File  |  1997-05-04  |  7KB  |  256 lines

  1. comment {
  2.                   Formula file provided with PHCTUTOR.TXT
  3.                   ---------------------------------------
  4.                       All formulas by Sylvie Gallet
  5.                       -----------------------------
  6.                  CompuServe: Sylvie_Gallet  [101324,3444]
  7.                    Internet: sylvie_gallet@compuserve.com
  8.   }
  9.  
  10. mandel { ; Mandel set of z^2 + c
  11.   z = c = pixel :
  12.    z = z*z + c
  13.     |z| <= 4
  14.   }
  15.  
  16. julia { ; Julia set of z^2 + (-0.75,0.1234)
  17.   z = pixel , c = (-0.75,0.1234) :
  18.    z = z*z + c
  19.     |z| <= 4
  20.   }
  21.  
  22. newton { ; Julia set of Newton's method applied to z^3 - 1 = 0
  23.   z = pixel :
  24.    n = z^3 - 1 , d = 3*z^2
  25.    z = z - n/d
  26.     |n| >= 0.000001
  27.   }
  28.  
  29. ; phc_mj { ; overlay the Mandel set of z^2 + c with
  30. ;         ; the Julia set of z^2 + (-0.75,0.1234)
  31. ;  z = pixel
  32. ;  c = pixel * (whitesq == 0) + (-0.75,0.1234) * whitesq :
  33. ;   z = z*z + c
  34. ;    |z| <= 4
  35. ;  }
  36.  
  37. phc_mj { ; overlay the Mandel set of z^2 + c with
  38.          ; the Julia set of z^2 + (-0.75,0.1234)
  39.          ; Modified for if..else logic, April 1997
  40.    z = pixel
  41.    IF (whitesq)
  42.       c = (-0.75,0.1234)
  43.    ELSE
  44.       c = pixel
  45.    ENDIF
  46.    :
  47.    z = z*z + c
  48.    |z| <= 4
  49.    }
  50.  
  51. : phc_mn_A { ; overlay the Mandel set of z^2 + c with the Julia
  52. ;           ; set of Newton's method applied to z^3 - 1 = 0
  53. ;  z = c = pixel :
  54. ;   n = z^3 - 1 , d = 3*z^2
  55. ;   z = (z*z + c) * (whitesq == 0) + (z - n/d) * whitesq
  56. ;    (|z| <= 4 && whitesq == 0) || (|n| >= 0.000001 && whitesq)
  57. ;  }
  58.  
  59. phc_mn_A { ; overlay the Mandel set of z^2 + c with the Julia
  60.            ; set of Newton's method applied to z^3 - 1 = 0
  61.            ; Modified for if..else logic, April 1997
  62.    z = pixel :
  63.    IF (whitesq)
  64.       n = z^3 - 1 , d = 3*z^2 , z = z - n/d
  65.       PHC_bailout = |n| >= 0.000001
  66.    ELSE
  67.       z = z*z + pixel , PHC_bailout = |z| <= 4
  68.    ENDIF
  69.    PHC_bailout
  70.    }
  71.  
  72. ; ptc_mjn_A { ; overlay the Mandel set of z^2 + c with the Julia set
  73. ;            ; of z^2 + (-0.75,0.1234) and the Julia set of Newton's
  74. ;            ; method applied to z^3 - 1 = 0
  75. ;  cr = real(scrnpix) + imag(scrnpix)
  76. ;  r = cr - 3 * trunc(cr / real(3))
  77. ;  z = pixel
  78. ;  c = pixel * (r == 0) + (-0.75,0.1234) * (r == 1) :
  79. ;   n = z^3 - 1 , d = 3*z^2
  80. ;   z = (z*z + c) * (r == 0 || r == 1) + (z - n/d) * (r == 2)
  81. ;    (|z| <= 4 && (r == 0 || r == 1)) || (|n| >= 0.000001 && r == 2)
  82. ;  }
  83.  
  84. ptc_mjn_A { ; overlay the Mandel set of z^2 + c with the Julia set
  85.             ; of z^2 + (-0.75,0.1234) and the Julia set of Newton's
  86.             ; method applied to z^3 - 1 = 0
  87.             ; Modified for if..else logic, April 1997
  88.    cr = real(scrnpix) + imag(scrnpix)
  89.    r = cr - 3 * trunc(cr / real(3))
  90.    z = pixel
  91.    IF (r == 0)
  92.       c = pixel
  93.    ELSEIF (r == 1)
  94.       c = (-0.75,0.1234)
  95.    ENDIF
  96.    :
  97.    IF (r == 2)
  98.       n = z^3 - 1 , d = 3*z^2 , z = z - n/d
  99.       PTC_bailout = |n| >= 0.000001
  100.    ELSE
  101.       z = z*z + c
  102.       PTC_bailout = |z| <= 4
  103.    ENDIF
  104.    PTC_bailout
  105.    }
  106.  
  107. mand_0 {
  108.   z = c = sin(pixel) :
  109.    z = z*z + c
  110.     |real(z)| <= 4
  111.   }
  112.  
  113. mand_1 {
  114.   z = c = pixel :
  115.    z = z*z + c
  116.     |z| <= 4
  117.   }
  118.  
  119. mand_2 {
  120.   z = c = 1/pixel :
  121.    z = z*z + c
  122.     |imag(z)| <= 4
  123.   }
  124.  
  125. mand_3 {
  126.   z = c = -pixel :
  127.    z = z*z + c
  128.     |real(z)+imag(z)| <= 4
  129.   }
  130.  
  131. ; phc_4m_A { ; overlay four Mandels with different initializations
  132. ;           ; and bailout tests
  133. ;           ; Isn't it terrific???
  134. ;  cr = real(scrnpix) + 2*imag(scrnpix)
  135. ;  r = cr - 4 * trunc(cr / 4)
  136. ;  c0 = sin(pixel) * (r == 0)
  137. ;  c1 = pixel * (r == 1)
  138. ;  c2 = 1/pixel * (r == 2)
  139. ;  c3 = -pixel * (r == 3)
  140. ;  z = c = c0 + c1 + c2 + c3 :
  141. ;   z = z*z + c
  142. ;   test_0 = |real(z)| <= 4  &&  r == 0
  143. ;   test_1 = |z| <= 4  &&  r == 1
  144. ;   test_2 = |imag(z)| <= 4  &&  r == 2
  145. ;   test_3 = |real(z)+imag(z)| <= 4  &&  r == 3
  146. ;    test_0 || test_1 || test_2 || test_3
  147. ;  }
  148.  
  149. ptc_4m_A { ; overlay four Mandels with different initializations
  150.            ; and bailout tests
  151.            ; Isn't it terrific???
  152.            ; Modified for if..else logic, April 1997
  153.    cr = real(scrnpix) + 2 * imag(scrnpix)
  154.    r = cr - 4 * trunc(cr / 4)
  155.    IF (r == 0)
  156.       z = c = sin(pixel)
  157.    ELSEIF (r == 1)
  158.       z = c = pixel
  159.    ELSEIF (r == 2)
  160.       z = c = 1/pixel
  161.    ELSE
  162.       z = c = -pixel
  163.    ENDIF
  164.    :
  165.    z = z*z + c
  166.    IF (r == 0)
  167.       PTC_bailout = |real(z)| <= 4
  168.    ELSEIF (r == 1)
  169.       PTC_bailout = |z| <= 4
  170.    ELSEIF (r == 2)
  171.       PTC_bailout = |imag(z)| <= 4
  172.    ELSE
  173.       PTC_bailout = |real(z)+imag(z)| <= 4
  174.    ENDIF
  175.    PTC_bailout
  176.    }
  177.  
  178. newton_B { ; Julia set of Newton's method applied to z^3 - 1 = 0
  179.   z = pixel :
  180.    z2 = z*z , n = z2*z - 1 , d = 3*z2
  181.    z = z - n/d
  182.     |n| >= 0.000001
  183.   }
  184.  
  185. ; phc_mn_B { ; overlay the Mandel set of z^2 + c with the Julia
  186. ;           ; set of Newton's method applied to z^3 - 1 = 0
  187. ;  z = c = pixel :
  188. ;   z2 = z*z , n = z2*z - 1 , d = 3*z2
  189. ;   z = (z2 + c) * (whitesq == 0) + (z - n/d) * whitesq
  190. ;    (|z| <= 4 && whitesq == 0) || (|n| >= 0.000001 && whitesq)
  191. ;  }
  192.  
  193. phc_mn_B { ; overlay the Mandel set of z^2 + c with the Julia
  194.            ; set of Newton's method applied to z^3 - 1 = 0
  195.            ; Modified for if..else logic, April 1997
  196.    z = pixel :
  197.    IF (whitesq)
  198.       z2 = z*z , n = z2*z - 1 , d = 3*z2 , z = z - n/d
  199.       PHC_bailout = |n| >= 0.000001
  200.    ELSE
  201.       z = z*z + pixel , PHC_bailout = |z| <= 4
  202.    ENDIF
  203.    PHC_bailout
  204.    }
  205.  
  206. ; ptc_mjn_B { ; overlay the Mandel set of z^2 + c with the Julia set
  207. ;            ; of z^2 + (-0.75,0.1234) and the Julia set of Newton's
  208. ;            ; method applied to z^3 - 1 = 0
  209. ;  cr = real(scrnpix) + imag(scrnpix)
  210. ;  r = cr - 3 * trunc(cr / real(3))
  211. ;  z = pixel
  212. ;  c = pixel * (r == 0) + (-0.75,0.1234) * (r == 1) :
  213. ;  z2 = z*z , n = z2*z - 1 , d = 3*z2
  214. ;   z = (z2 + c) * (r != 2) + (z - n/d) * (r == 2)
  215. ;    (|z| <= 4 && r != 2) || (|n| >= 0.000001 && r == 2)
  216. ;  }
  217.  
  218. ptc_mjn_B { ; overlay the Mandel set of z^2 + c with the Julia set
  219.             ; of z^2 + (-0.75,0.1234) and the Julia set of Newton's
  220.             ; method applied to z^3 - 1 = 0
  221.             ; Modified for if..else logic, April 1997
  222.    cr = real(scrnpix) + imag(scrnpix)
  223.    r = cr - 3 * trunc(cr / real(3))
  224.    z = pixel
  225.    IF (r == 0)
  226.       c = pixel
  227.    ELSEIF (r == 1)
  228.       c = (-0.75,0.1234)
  229.    ENDIF
  230.    :
  231.    IF (r == 2)
  232.       z2 = z*z , n = z2*z - 1 , d = 3*z2 , z = z - n/d
  233.       PTC_bailout = |n| >= 0.000001
  234.    ELSE
  235.       z = z*z + c
  236.       PTC_bailout = |z| <= 4
  237.    ENDIF
  238.    PTC_bailout
  239.    }
  240.  
  241. ; phc_4m_B { ; overlay four Mandels with different initializations
  242. ;           ; and bailout tests
  243. ;           ; Isn't it terrific???
  244. ;  cr = real(scrnpix) + 2*imag(scrnpix)
  245. ;  r = cr - 4 * trunc(cr / 4)
  246. ;  c0 = sin(pixel) * (r == 0)
  247. ;  c2 = 1/pixel * (r == 2)
  248. ;  z = c = c0 + c2 + pixel * ((r == 1) - (r == 3)) :
  249. ;   z = z*z + c
  250. ;   test_0 = |real(z)| <= 4  &&  r == 0
  251. ;   test_1 = |z| <= 4  &&  r == 1
  252. ;   test_2 = |imag(z)| <= 4  &&  r == 2
  253. ;   test_3 = |real(z)+imag(z)| <= 4  &&  r == 3
  254. ;    test_0 || test_1 || test_2 || test_3
  255. ;  }
  256.