home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-387-Vol-3of3.iso / f / fracxtr4.zip / FRACTINT.FRM < prev    next >
Text File  |  1993-02-08  |  10KB  |  415 lines

  1. comment {
  2.  FRACTINT.DOC has instructions for adding new formulas to this file.
  3.  There are several hard-coded restrictions in the formula interpreter:
  4.  
  5.  1) The fractal name through the open curly bracket must be on a single line.
  6.  2) There is a hard-coded limit of 200 formulas per formula file, only
  7.     because of restrictions in the prompting routines.
  8.  3) Formulas can containt at most 250 operations (references to variables and
  9.     arithmetic); this is bigger than it sounds, no formula in the default
  10.     fractint.frm uses even 100
  11.  3) Comment blocks can be set up using dummy formulas with no formula name
  12.     or with the special name "comment".
  13.  
  14.  The formulas at the beginning of this file are from Mark Peterson, who
  15.  built this fractal interpreter feature.  The rest are grouped by contributor.
  16.  (Scott Taylor sent many but they are no longer here - they've been
  17.  incorporated as hard-coded types.  Lee Skinner also sent many which have
  18.  now been hard-coded.)
  19.  
  20.  Note that the builtin "cos" function had a bug which was corrected in
  21.  version 16.  To recreate an image from a formula which used cos before
  22.  v16, change "cos" in the formula to "cosxx" which is a new function
  23.  provided for backward compatibility with that bug.
  24.  }
  25.  
  26. Mandelbrot(XAXIS) {; Mark Peterson
  27.   ; Classical fractal showing LastSqr speedup
  28.   z = Pixel, z = Sqr(z):  ; Start with z**2 to initialize LastSqr
  29.    z = z + Pixel
  30.    z = Sqr(z)
  31.     LastSqr <= 4      ; Use LastSqr instead of recalculating
  32.   }
  33.  
  34. Dragon (ORIGIN) {; Mark Peterson
  35.   z = Pixel:
  36.    z = sqr(z) + (-0.74543, 0.2),
  37.     |z| <= 4
  38.   }
  39.  
  40. Daisy (ORIGIN) {; Mark Peterson
  41.   z = pixel:
  42.    z = z*z + (0.11031, -0.67037),
  43.     |z| <= 4
  44.   }
  45.  
  46. InvMandel (XAXIS) {; Mark Peterson
  47.   c = z = 1 / pixel:
  48.    z = sqr(z) + c;
  49.     |z| <= 4
  50.   }
  51.  
  52. DeltaLog(XAXIS) {; Mark Peterson
  53.   z = pixel, c = log(pixel):
  54.    z = sqr(z) + c,
  55.     |z| <= 4
  56.   }
  57.  
  58. Newton4(XYAXIS) {; Mark Peterson
  59.   z = pixel, Root = 1:
  60.    z3 = z*z*z;
  61.    z4 = z3 * z;
  62.    z = (3 * z4 + Root) / (4 * z3);
  63.     .004 <= |z4 - Root|
  64.   }
  65.  
  66. comment {
  67.    The following are from Chris Green:
  68.    These fractals all use Newton's or Halley's formula for approximation
  69.    of a function.  In all of these fractals, p1 is the "relaxation
  70.    coefficient". A value of 1 gives the conventional newton or halley
  71.    iteration. Values <1 will generally produce less chaos than values >1.
  72.    1-1.5 is probably a good range to try.  P2 is the imaginary component
  73.    of the relaxation coefficient, and should be zero but maybe a small
  74.    non-zero value will produce something interesting. Who knows?
  75.    For more information on Halley maps, see "Computers, Pattern, Chaos,
  76.    and Beauty" by Pickover.
  77.    }
  78.  
  79. Halley (XYAXIS) {; Chris Green. Halley's formula applied to x^7-x=0.
  80.   ; P1 usually 1 to 1.5, P2 usually zero. Use floating point.
  81.   ; Setting P1 to 1 creates the picture on page 277 of Pickover's book
  82.   z=pixel:
  83.    z5=z*z*z*z*z;
  84.    z6=z*z5;
  85.    z7=z*z6;
  86.    z=z-p1*((z7-z)/ ((7.0*z6-1)-(42.0*z5)*(z7-z)/(14.0*z6-2))),
  87.     0.0001 <= |z7-z|
  88.   }
  89.  
  90. CGhalley (XYAXIS) {; Chris Green -- Halley's formula
  91.   ; P1 usually 1 to 1.5, P2 usually zero. Use floating point.
  92.   z=(1,1):
  93.    z5=z*z*z*z*z;
  94.    z6=z*z5;
  95.    z7=z*z6;
  96.    z=z-p1*((z7-z-pixel)/ ((7.0*z6-1)-(42.0*z5)*(z7-z-pixel)/(14.0*z6-2))),
  97.     0.0001 <= |z7-z-pixel|
  98.   }
  99.  
  100. halleySin (XYAXIS) {; Chris Green. Halley's formula applied to sin(x)=0.
  101.   ; Use floating point.
  102.   ; P1 = 0.1 will create the picture from page 281 of Pickover's book.
  103.   z=pixel:
  104.    s=sin(z), c=cos(z)
  105.    z=z-p1*(s/(c-(s*s)/(c+c))),
  106.     0.0001 <= |s|
  107.   }
  108.  
  109. NewtonSinExp (XAXIS) {; Chris Green
  110.   ; Newton's formula applied to sin(x)+exp(x)-1=0.
  111.   ; Use floating point.
  112.   z=pixel:
  113.    z1=exp(z)
  114.    z2=sin(z)+z1-1
  115.    z=z-p1*z2/(cos(z)+z1),
  116.     .0001 < |z2|
  117.   }
  118.  
  119. HyperMandel {; Chris Green.
  120.   ; A four dimensional version of the mandelbrot set.
  121.   ; Use P1 to select which two-dimensional plane of the
  122.   ; four dimensional set you wish to examine.
  123.   ; Use floating point.
  124.   a=(0,0),b=(0,0):
  125.    z=z+1
  126.    anew=sqr(a)-sqr(b)+pixel
  127.    b=2.0*a*b+p1
  128.    a=anew,
  129.     |a|+|b| <= 4
  130.   }
  131.  
  132. Cubic (XYAXIS) {; Lee Skinner
  133.   p = pixel, test = p1 + 3,
  134.   t3 = 3*p, t2 = p*p,
  135.   a = (t2 + 1)/t3, b = 2*a*a*a + (t2 - 2)/t3,
  136.   aa3 = a*a*3, z = 0 - a :
  137.    z = z*z*z - aa3*z + b,
  138.     |z| < test
  139.  }
  140.  
  141. { The following are from Lee Skinner, have been partially generalized. }
  142.  
  143. Fzppfnre  {; Lee Skinner
  144.   z = pixel, f = 1./(pixel):
  145.    z = fn1(z) + f,
  146.     |z| <= 50
  147.   }
  148.  
  149. Fzppfnpo  {; Lee Skinner
  150.   z = pixel, f = (pixel)^(pixel):
  151.    z = fn1(z) + f,
  152.     |z| <= 50
  153.   }
  154.  
  155. Fzppfnsr  {; Lee Skinner
  156.   z = pixel, f = (pixel)^.5:
  157.    z = fn1(z) + f,
  158.     |z| <= 50
  159.   }
  160.  
  161. Fzppfnta  {; Lee Skinner
  162.   z = pixel, f = tan(pixel):
  163.    z = fn1(z) + f,
  164.     |z|<= 50
  165.   }
  166.  
  167. Fzppfnct  {; Lee Skinner
  168.   z = pixel, f = cos(pixel)/sin(pixel):
  169.    z = fn1(z) + f,
  170.     |z|<= 50
  171.   }
  172.  
  173. Fzppfnse  {; Lee Skinner
  174.   z = pixel, f = 1./sin(pixel):
  175.    z = fn1(z) + f,
  176.     |z| <= 50
  177.   }
  178.  
  179. Fzppfncs  {; Lee Skinner
  180.   z = pixel, f = 1./cos(pixel):
  181.    z = fn1(z) + f,
  182.     |z| <= 50
  183.   }
  184.  
  185. Fzppfnth  {; Lee Skinner
  186.   z = pixel, f = tanh(pixel):
  187.    z = fn1(z)+f,
  188.     |z|<= 50
  189.   }
  190.  
  191. Fzppfnht  {; Lee Skinner
  192.   z = pixel, f = cosh(pixel)/sinh(pixel):
  193.    z = fn1(z)+f,
  194.     |z|<= 50
  195.   }
  196.  
  197. Fzpfnseh  {; Lee Skinner
  198.   z = pixel, f = 1./sinh(pixel):
  199.    z = fn1(z) + f,
  200.     |z| <= 50
  201.   }
  202.  
  203. Fzpfncoh  {; Lee Skinner
  204.   z = pixel, f = 1./cosh(pixel):
  205.    z = fn1(z) + f,
  206.     |z| <= 50
  207.   }
  208.  
  209.  
  210. { The following resulted from a FRACTINT bug. Version 13 incorrectly
  211.   calculated Spider (see above). We fixed the bug, and reverse-engineered
  212.   what it was doing to Spider - so here is the old "spider" }
  213.  
  214. Wineglass(XAXIS) {; Pieter Branderhorst
  215.   c = z = pixel:
  216.    z = z * z + c
  217.    c = (1+flip(imag(c))) * real(c) / 2 + z,
  218.     |z| <= 4 }
  219.  
  220.  
  221. { The following is from Scott Taylor.
  222.   Scott says they're "Dog" because the first one he looked at reminded him
  223.   of a hot dog. This was originally several fractals, we have generalized it. }
  224.  
  225. Ent {; Scott Taylor
  226.   ; Try params=.5/.75 and the first function as exp.
  227.   ; Zoom in on the swirls around the middle.  There's a
  228.   ; symmetrical area surrounded by an asymmetric area.
  229.   z = Pixel, y = fn1(z), base = log(p1):
  230.    z = y * log(z)/base,
  231.     |z| <= 4
  232.   }
  233.  
  234. Ent2 {; Scott Taylor
  235.   ; try params=2/1, functions=cos/cosh, potential=255/355
  236.   z = Pixel, y = fn1(z), base = log(p1):
  237.    z = fn2( y * log(z) / base ),
  238.     |z| <= 4
  239.   }
  240.  
  241. { From Kevin Lee: }
  242.  
  243. LeeMandel1(XYAXIS) {; Kevin Lee
  244.   z=Pixel:
  245. ;; c=sqr(pixel)/z, c=z+c, z=sqr(z),  this line was an error in v16
  246.    c=sqr(pixel)/z, c=z+c, z=sqr(c),
  247.     |z|<4
  248.   }
  249.  
  250. LeeMandel2(XYAXIS) {; Kevin Lee
  251.   z=Pixel:
  252.    c=sqr(pixel)/z, c=z+c, z=sqr(c*pixel),
  253.     |z|<4
  254.    }
  255.  
  256. LeeMandel3(XAXIS) {; Kevin Lee
  257.   z=Pixel, c=Pixel-sqr(z):
  258.    c=Pixel+c/z, z=c-z*pixel,
  259.     |z|<4
  260.   }
  261.  
  262. { These are a few of the examples from the book,
  263.   Fractal Creations, by Tim Wegner and Mark Peterson. }
  264.  
  265. MyFractal {; Fractal Creations example
  266.   c = z = 1/pixel:
  267.    z = sqr(z) + c;
  268.     |z| <= 4
  269.   }
  270.  
  271. Bogus1 {; Fractal Creations example
  272.   z = 0; z = z + * 2,
  273.    |z| <= 4 }
  274.  
  275. MandelTangent {; Fractal Creations example (revised for v.16)
  276.   z = pixel:
  277.    z = pixel * tan(z),
  278.     |real(z)| < 32
  279.   }
  280.  
  281. Mandel3 {; Fractal Creations example
  282.   z = pixel, c = sin(z):
  283.    z = (z*z) + c;
  284.    z = z * 1/c;
  285.     |z| <= 4;
  286.    }
  287.  
  288. { These are from: "AKA MrWizard W. LeRoy Davis;SM-ALC/HRUC"
  289.           davisl@sm-logdis1-aflc.af.mil
  290.   The first 3 are variations of:
  291.                z
  292.        gamma(z) = (z/e) * sqrt(2*pi*z) * R        }
  293.  
  294. Sterling(XAXIS) {; davisl
  295.   z = Pixel:
  296.    z = ((z/2.7182818)^z)/sqr(6.2831853*z),
  297.     |z| <= 4
  298.   }
  299.  
  300. Sterling2(XAXIS) {; davisl
  301.   z = Pixel:
  302.    z = ((z/2.7182818)^z)/sqr(6.2831853*z) + pixel,
  303.     |z| <= 4
  304.   }
  305.  
  306. Sterling3(XAXIS) {; davisl
  307.   z = Pixel:
  308.    z = ((z/2.7182818)^z)/sqr(6.2831853*z) - pixel,
  309.     |z| <= 4
  310.   }
  311.  
  312. PsudoMandel(XAXIS) {; davisl - try center=0,0/magnification=28
  313.   z = Pixel:
  314.    z = ((z/2.7182818)^z)*sqr(6.2831853*z) + pixel,
  315.     |z| <= 4
  316.   }
  317.  
  318. { These are the original "Richard" types sent by Jm Richard-Collard. Their
  319.   generalizations are tacked on to the end of the "Jm" list below, but
  320.   we felt we should keep these around for historical reasons.}
  321.  
  322. Richard1 (XYAXIS) {; Jm Richard-Collard
  323.   z = pixel:
  324.    sq=z*z, z=(sq*sin(sq)+sq)+pixel,
  325.     |z|<=50
  326.   }
  327.  
  328. Richard2 (XYAXIS) {; Jm Richard-Collard
  329.   z = pixel:
  330.    z=1/(sin(z*z+pixel*pixel)),
  331.     |z|<=50
  332.   }
  333.  
  334. Richard3 (XAXIS) {; Jm Richard-Collard
  335.   z = pixel:
  336.    sh=sinh(z), z=(1/(sh*sh))+pixel,
  337.     |z|<=50
  338.   }
  339.  
  340. Richard4 (XAXIS) {; Jm Richard-Collard
  341.   z = pixel:
  342.    z2=z*z, z=(1/(z2*cos(z2)+z2))+pixel,
  343.     |z|<=50
  344.   }
  345.  
  346. Richard5 (XAXIS) {; Jm Richard-Collard
  347.   z = pixel:
  348.    z=sin(z*sinh(z))+pixel,
  349.     |z|<=50
  350.   }
  351.  
  352. Richard6 (XYAXIS) {; Jm Richard-Collard
  353.   z = pixel:
  354.    z=sin(sinh(z))+pixel,
  355.     |z|<=50
  356.   }
  357.  
  358. Richard7 (XAXIS) {; Jm Richard-Collard
  359.   z=pixel:
  360.    z=log(z)*pixel,
  361.     |z|<=50
  362.   }
  363.  
  364. Richard8 (XYAXIS) {; Jm Richard-Collard
  365.   ; This was used for the "Fractal Creations" cover
  366.   z=pixel,sinp = sin(pixel):
  367.    z=sin(z)+sinp,
  368.     |z|<=50
  369.   }
  370.  
  371. Richard9 (XAXIS) {; Jm Richard-Collard
  372.   z=pixel:
  373.    sqrz=z*z, z=sqrz + 1/sqrz + pixel,
  374.     |z|<=4
  375.   }
  376.  
  377. Richard10(XYAXIS) {; Jm Richard-Collard
  378.   z=pixel:
  379.    z=1/sin(1/(z*z)),
  380.     |z|<=50
  381.   }
  382.  
  383. Richard11(XYAXIS) {; Jm Richard-Collard
  384.   z=pixel:
  385.    z=1/sinh(1/(z*z)),
  386.     |z|<=50
  387.   }
  388.  
  389. Gamma(XAXIS)={ ; first order gamma function from Prof. Jm
  390.   ; "It's pretty long to generate even on a 486-33 comp but there's a lot
  391.   ; of corners to zoom in and zoom and zoom...beautiful pictures :)"
  392.   z=pixel,twopi=6.283185307179586,r=10:
  393.    z=(twopi*z)^(0.5)*(z^z)*exp(-z)+pixel
  394.     |z|<=r
  395.   }
  396.  
  397. ZZ(XAXIS) { ; Prof Jm using Newton-Raphson method
  398.   ; use floating point with this one
  399.   z=pixel,solution=1:
  400.    z1=z^z;
  401.    z2=(log(z)+1)*z1;
  402.    z=z-(z1-1)/z2 ,
  403.     0.001 <= |solution-z1|
  404.   }
  405.  
  406. ZZa(XAXIS) { ; Prof Jm using Newton-Raphson method
  407.   ; use floating point with this one
  408.   z=pixel,solution=1:
  409.    z1=z^(z-1);
  410.    z2=(((z-1)/z)+log(z))*z1;
  411.    z=z-((z1-1)/z2) ,
  412.     .001 <= |solution-z1|
  413.   }
  414.  
  415.