home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / graf / plotfrac.zip / PLOTFRAC.DOC < prev    next >
Text File  |  1988-02-04  |  13KB  |  215 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.                                           P L O T F R A C
  8.                            (A general purpose fractal graphics generator)
  9.  
  10.                                              Written By
  11.                                            Ronald F. Merts
  12.  
  13.                                    Copyright (C) 1986, 1987, 1988
  14.                                       Oklahoma Digital Systems
  15.  
  16.  
  17.  
  18.  
  19.             PLOTFRAC is  a general  purpose program  which will plot either the Mandelbrot
  20.             Set or the Julia Set of a specified function
  21.  
  22.                  F(z) = z^n + c.
  23.  
  24.             The Mandelbrot Set(s) and Julia  Set(s)  are  generated  via  a  feedback loop
  25.             function (the  actual use for F(z)).  That is to say, point k+1 is found using
  26.             the k-the value of X and Y for the function F(z).  You may ask where did X and
  27.             Y come from?  Well in the function F(z) the feedback is specified as
  28.  
  29.                  z |--> z^n + c
  30.  
  31.             where z  = x  + iy  and c = p + iq. (What is that "i"?  That means the "z" and
  32.             "c" are actually complex numbers.) If we let  the polynomial  (function) be of
  33.             degree two (2), that is let n = 2 so that we get
  34.  
  35.                  F(z) = z^2 + c.
  36.  
  37.             Now if we substitute "x + iy" for "z" and "p + iq" for "c" we get
  38.  
  39.                  F(x,y)  = (x + iy)^2 + p + iq
  40.                          = x^2 + 2xyi - y^2 + p + iq.
  41.  
  42.             If you  notice the  sign in  front of  "y^2" is minus (-).  That is because if
  43.             you'll remember i*i = -1.  Since we  need to  separate the  function F(z) into
  44.             it's real and imaginary parts we get the following
  45.  
  46.                  x[k+1] = x[k]^2 - y[k]^2 + p   and
  47.                  y[k+1] = 2*x[k]*y[k] + q.
  48.  
  49.             What happened to the "i"'s?  They are not needed by the computer; in fact they
  50.             are only there for your  benefit...but  they  are  needed  when  expanding the
  51.             polynomial from  the (x  + iy)^n form to keep the signs correct and to help in
  52.             separating the real from the imaginary numbers.  After rewriting  the original
  53.             PLOTFRAC three times to plot three different fractals, I decided to change the
  54.             program to have it generate its own "expanded" polynomial.  Using the binomial
  55.             theorem, I  expanded the function (x + y)^n; but now I had to adjust the signs
  56.             for the squaring of imaginary numbers.   This  is not  hard at  all, since the
  57.             signs  follow  a  "++--++--..."  pattern;  so  after the program generates the
  58.             polynomial; it simply loops through changing the signs.  I had the program all
  59.             ready; then  I accidentally  found out  that the  Microsoft 'C' pow() function
  60.             conflicts with the ROM BIOS graphics interrupts.  I am  not sure  whether this
  61.             is due  to my  "clone" ROM  or if  it is a problem with the pow function being
  62.             used with an 8087 and the ROM BIOS interrupts...the problem  first arose after
  63.             installing my 8087 math co-processor.  That is why there is a pow_r() function
  64.             defined and used at the end of PLOTFRAC.
  65.  
  66.             To  use  the  PLOTFRAC  program  make  sure  that  the  two   following  files
  67.             PLOTFRAC.EXE and CWINDOWS.COM are present on the current directory.  Then type
  68.             PLOTFRAC.
  69.  
  70.             The PLOTFRAC program will load the CWINDOWS program; and then begin executing.
  71.             If you  have an 8087 or 80287 math co processor, it will be automatically used
  72.             by the program; if you do  not, then  an 8087  emulator routine  will be used.
  73.             You will  not have  the speed of an actual 8087; but it will hold the accuracy
  74.             to usually within 2 places.
  75.  
  76.             The program will present you with a menu  of five  options (Plot  a Julia Set,
  77.             Plot a  Mandelbrot Set,  Load an old plot, DIRectory of .PIC files and Quit to
  78.             DOS).  Option 4 will give  you a  list of  all your  plots, assuming  you have
  79.  
  80.  
  81.  
  82.  
  83.  
  84.             given them all the three letter extension of .PIC.  The PIC files are going to
  85.             be the target of the next major update to PLOTFRAC.   I  will try  and include
  86.             some sort of convert utility to allow continued use of older plots with newer
  87.             versions.
  88.  
  89.  
  90.                  PLOTTING FRACTAL GRAPHS
  91.  
  92.             The main  function of this program is to allow you to plot fractal graphics on
  93.             your PC.  The minimum requirements are:
  94.  
  95.                  IBM-PC, PC/AT or compatible (ROM-BIOS MUST be compatible)
  96.                  Color Graphics  Adapter  (CGA)  or  Enhanced  Graphics  Adapter with
  97.                  either a Color Monitor (RGB) or Enhanced Color Display (EGA monitor)
  98.                  256K  User  available  RAM  (384K  total  RAM  needed), 512K-640K is
  99.                  recommended
  100.                  One, 360K floppy or Hard-drive (recommended)
  101.  
  102.                  (Optional) 8087/80287 math co-processor
  103.  
  104.             After selecting which type of  fractal  to  plot,  you  will  be  asked  for a
  105.             filename to save the picture to.  I recommend using the three letter extension
  106.             of .PIC so that Option 4 from the main menu will work as designed.
  107.  
  108.             Now you must choose the order or "degree" of the feedback polynomial  you wish
  109.             to use.  The most popular is possibly the "z^2 + c" polynomial, but by varying
  110.             the degree (the value "n" in the equation  F(z) =  z^n +  c); some interesting
  111.             results  occur.    The  entire  Mandelbrot set is usually contained within the
  112.             region -3...+3 (P_MIN and P_MAX) and -2...+2 (Q_MIN  and Q_MAX);  likewise the
  113.             entire Julia  Set is  usually contained  within the same region (X_MIN...X_MAX
  114.             and Y_MIN...Y_MAX).  If you are plotting a Julia Set,  you will  then be asked
  115.             to supply  the constant values for p and q (from the complex number 'q' in the
  116.             polynomial F(z)).  Best results are usually obtained  when these  are near the
  117.             boundary of the associated Mandelbrot Set.
  118.  
  119.             Next you  will be  prompted for  the parameters M and K.  M is the variable we
  120.             set  to  check  and  see  if  our  function  is  escaping  toward  infinity or
  121.             converging.   It is  usually best  set to  100 and left, although satisfactory
  122.             results have been obtained with it  set at  or around  75 or  more.   K is the
  123.             number of  colors available  on your  system.   Since the  IBM CGA  has only 4
  124.             colors; this means that our function will only  be executed  4 times  at most.
  125.             This is  not at  all sufficient, so I recommend you set K at 200.  If you have
  126.             lowered the value for M, set K to twice the value of M and make sure that it
  127.             is divisible by 4 (I.E. if M=75, set K=152).   The program  will automatically
  128.             convert the number to the proper color if necessary.
  129.  
  130.             Lastly you will be asked if you want the plot in 320 X 200, 4-color; 640 X 200
  131.             black and white, 320 X 200, 16-color or 640 X 200, 16-color  (NOTE:   EGA card
  132.             required for 16 color plots).  The banding patterns can be quite striking; and
  133.             you lose these in  the  640  X  200  Black  and  White  mode;  but  the actual
  134.             Mandelbrot or Julia Set is more clearly defined.
  135.  
  136.             If you have an math co-processor; your can expect your plot to be completed in
  137.             around 45 minutes to 4 hours; depending on  the degree  of the  polynomial and
  138.             the difference  between X_MIN  and X_MAX,  Y_MIN and  Y_MAX or P and Q MIN and
  139.             MAX.  The higher the degree or the smaller the difference between  the MIN and
  140.             MAX;  the  longer  the  computational  time.    If  you  do  not  have  a math
  141.             co-processor; you can expect your plots  to be  completed in  2 -  12 hours or
  142.             more (no kidding).
  143.  
  144.  
  145.                  AFTER THE PLOT IS DONE
  146.  
  147.             After the  program has finished plotting your function, or loading an existing
  148.             function; you have 6 options  available  through  7  commands.    They  are as
  149.             follows:
  150.  
  151.                  <CR> or <ESC> -- Leave the plot and return to the main menu.
  152.                  D or  d        -- Print the current plot on an Epson or Epson compatable
  153.                                   printer (I.E. Epson MX, RX or  FX, Seikosha  SP-1000).
  154.                                   This function  only prints the black region of the plot,
  155.                                   not the associated colors.
  156.  
  157.  
  158.  
  159.  
  160.  
  161.                  C or c        -- This function places a black  line, starting  at column
  162.                                   one (1) and proceeding every-other line (I.E. columns 1,
  163.                                   3, 5, 7, Etc.).  This is to allow you to determine  new
  164.                                   starting and  ending values for the function in the X or
  165.                                   P direction.  I am working  on a  more sophisticated
  166.                                   method of  doing this; but until then this will have to
  167.                                   do, and it does work.
  168.                  H or h        -- This function places a black line, horizontally  across
  169.                                   the first  25 columns of the screen; starting at line 1
  170.                                   and on each 5th line afterwards (I.E.   Line 1,  5, 10,
  171.                                   Etc.).   This will  allow you to determine new starting
  172.                                   and ending values for Y or Q direction.
  173.                  B or b        -- This function will  allow you  to change  the background
  174.                                   color of  the plot  to any  of the  standard CGA colors.
  175.                                   This only works with the 320 X 200 CGA mode plots.
  176.                  P or p        -- This function allows you to  switch between  the two CGA
  177.                                   mode color  palettes (White,  Cyan and  Violet; or Red,
  178.                                   Green and Yellow).  This also only works with the CGA
  179.                                   320  X 200 plots.
  180.  
  181.                  OTHER STUFF
  182.  
  183.             This completes the documentation on PLOTFRAC.EXE.  The program has been tested
  184.             extensively by myself as well as several friends,  and it  appears as bug-free
  185.             as possible.   This  does not mean it is completely bug-free; but as of yet we
  186.             haven't encountered any.  The author of the program makes no warranty, implied
  187.             or otherwise,  as to  the functionality  of the program.  It is provided on an
  188.             "as-is" basis; and I will not accept any liability for it's use or misuse.   I
  189.             am continually  trying to make updates and changes to the program, and the new
  190.             versions of PLOTFRAC may or may not be  compatable with  older versions.   The
  191.             most recent  changes have  made this  version of  PLOTFRAC (V2.5) incompatable
  192.             with previous versions.  This is due to a change  I made  in the  data that is
  193.             stored when the plot is saved.  This version should remain compatable with the
  194.             next version (2.7) of PLOTFRAC; but  it  may  not  remain  so  with subsequent
  195.             versions.  I will try and include a "convert" utility to allow users to change
  196.             older plots to be compatable with  new versions;  but I  won't guarantee there
  197.             will be any such programs.
  198.  
  199.             If you have any questions, you may contact me on the White House BBS at
  200.             (405) 799-2638  (300/1200/2400 baud, 8-Bits, No Parity, 1 Stop bit); and leave
  201.             E-mail or Feedback to user #2.
  202.  
  203.  
  204.  
  205.             ADDITIONAL NOTES FOR VERSION 3.0
  206.  
  207.             Version 3.0 now adds support for EGA's 640 X 350 mode with 16 colors available.
  208.             Also changed is the routine for handling windows.  Previous versions required
  209.             NANSI.SYS or NANSI286.SYS  for the windows to function properly; this version
  210.             will function properly with NANSI.SYS, NANSI286.SYS or ANSI.SYS.  This is due
  211.             to  a change from  WINDBIOS.COM,  a windowing  BIOS extension,  to  Vitamin-C
  212.             libraries.  Although this means that full source code is not available, it did
  213.             mean full compatability  with most IBM and  compatable systems.  The plotting
  214.             worked fine, but the window performance without NANSI.SYS was rather strange.
  215.