home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 177.lha / Newton_v1.0 / README < prev    next >
Text File  |  1988-04-28  |  4KB  |  111 lines

  1. ########################################################################
  2. # Newton:    Estimate the roots of a polynomial equation.
  3. #        Author:  Dan Barrett, barrett@cs.jhu.edu (ARPAnet).
  4. #        100% PUBLIC DOMAIN, both source code & executable.
  5. #
  6. #        Written for the Commodore Amiga, September 1988.
  7. #        Runs from the CLI only.
  8. #        Also compiles & runs under Berkeley UNIX 4.2.
  9. ########################################################################
  10.  
  11. What is Newton?
  12. ---------------
  13.     Given a polynomial equation F(x) = 0, Newton estimates the 
  14. roots of the equation.  The program uses an algorithm known as
  15. "Newton's Method".  You can read about the specifics in any college
  16. textbook on Numerical Analysis.
  17.  
  18.  
  19. How is it used?
  20. ---------------
  21.     From the CLI, type "newton", followed by <RETURN>.
  22.  
  23.     You will be prompted for the degree of the polynomial equation.
  24. The degree is the largest exponent in the equation.  The maximum
  25. allowable degree is 20.  You can change this in the source code
  26. by changing the value of MAX_DEGREE in decl.h.
  27.  
  28.     Next, you are prompted for the "desired accuracy".  Since
  29. Newton's Method is a "numerical" method, the answers you get are
  30. only estimates of the actual value.
  31.     The accuracy is a measure of how close an estimate must
  32. be before it is considered "correct".  In mathematical language,
  33. the Euclidean distance (in the complex plane) between the current
  34. estimate and the previous estimate must not exceed the "accuracy".
  35.  
  36.     In the source code, the variable "epsilon" represents the
  37. accuracy.  See also the function ErrorTooBig(), which actually tests
  38. the accuracy of the latest estimate.
  39.  
  40.     To choose the default accuracy, simply press <RETURN>.  Otherwise,
  41. type in your desired accuracy.  The smaller the value, the more accurate
  42. your result (and the longer the program will run).
  43.  
  44.     Finally, you are prompted for your polynomial coefficients.
  45. For example, when you are asked:
  46.  
  47.         X^5 coefficient?:
  48.  
  49. you should type in the coefficient of your X-to-the-5th-power term.
  50.  
  51.     Coefficients may be real or complex numbers.  If the coefficient
  52. is real, simply type it in and press <RETURN>.  If the coefficient is
  53. complex, type in its real and imaginary parts, separated by spaces
  54. and/or tabs, and press <RETURN>.
  55.  
  56. "Real" example:
  57.  
  58.         X^5 coefficient?: 6.33 <RETURN>
  59.  
  60. "Complex" example, for the complex value -5 + 0.43i :
  61.  
  62.         X^5 coefficient?: -5  0.43 <RETURN>
  63.  
  64. Note that you must type in EVERY coefficient, even if it is a zero.
  65.  
  66.     While you are entering coefficients, you can type "H", "h", or "?"
  67. for a brief "help" message.
  68.  
  69.  
  70. Now What Happens?
  71. -----------------
  72.  
  73.     First, "Newton" will display your polynomial, as you typed
  74. it in.
  75.  
  76.     Then, "Newton" will calculate the roots of your polynomial
  77. equation.
  78.  
  79.     This calculation might take some time (a few minutes), depending
  80. on the degree of the equation and the desired accuracy.  Higher accuracy
  81. takes more time, as you might guess.  Sometimes, the calculation takes
  82. only a few seconds.
  83.  
  84.     Since "Newton" uses a numerical algorithm, there is the possibility
  85. that it will not find a solution.  If "Newton" cannot find the value of
  86. a root after 10,000 iterations, it will report failure.  (This number
  87. of iterations is set in decl.h as MAX_ITERATIONS... feel free to change
  88. it.)
  89.  
  90.     So, if "Newton" seems to be sitting there not doing anything,
  91. don't panic.  After a few minutes, it will either find a solution
  92. or quit automatically.
  93.  
  94.  
  95. Compiling Information
  96. ---------------------
  97.  
  98.     The enclosed "Makefile" is for use with Aztec Manx C, V3.6a.
  99. "Newton" probably compiles & runs under Lattice C, though I can't
  100. test it.
  101.  
  102.     Math (floating point) calculations can be handled in three
  103. different ways.  Edit the Makefile and uncomment the desired
  104. CFLAGS and LIBS parameters.  They are explained in the Makefile itself.
  105. See also the "New Options For CC" page (cc.ap.1, V3.4a) in the Manx
  106. C manual.
  107.  
  108.     The enclosed "Makefile.unix" is for compiling "Newton" under
  109. UNIX (Berkeley UNIX 4.2 or Ultrix).  It does not use strtok.c; I am
  110. assuming that your UNIX has the strtok() function provided.
  111.