home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 1 / ARM_CLUB_CD.iso / contents / apps / maths / progs / solver / !Solver / !Help / Readme < prev    next >
Encoding:
Text File  |  1991-05-03  |  11.6 KB  |  335 lines

  1. ***************************** Copyright Notice ****************************
  2. *                                                                         *
  3. *                          (C)1991 Duco Fennema                           *
  4. *                                                                         *
  5. *    Read the 'Terms of Use' chapter at the end of this file to know      *
  6. *             what you may and may not do with this program.              *
  7. *                                                                         *
  8. ***************************************************************************
  9.  
  10.  
  11.                     ReadMe file for !Solver v1.10
  12.  
  13.  
  14.                 equation solver (like HP calculators)
  15.  
  16.  
  17.  
  18.  
  19.  
  20.         Contents___________________________________________________
  21.  
  22.         This file contains 11 chapters in this order.
  23.           -Why !Solver
  24.           -Using !Solver
  25.           -Using !Solver as a Evaluator
  26.           -Using the library
  27.           -Extending the library
  28.           -How it works
  29.           -Alternative solving methods
  30.           -Acknowledgements
  31.           -Terms of use
  32.           -Release information
  33.           -Correspondence
  34.  
  35.  
  36.  
  37.         Why !Solver ?______________________________________________
  38.  
  39.         Do you know those handy Hewlett Packard calculators with a
  40.         Solver program?
  41.         Well I do, my brother has one, and it is very handy.
  42.         I found it indispensable when calculating the maximum gain
  43.         from given a fase margin for a second order process with
  44.         delay time.
  45.         Thus an idea came to my mind, to give my Archimedes the same
  46.         capability.
  47.  
  48.  
  49.  
  50.         Using !Solver______________________________________________
  51.  
  52.         The Solver main window has three writable icons.
  53.  
  54.         In the top icon 'Equation in X' you may enter an equation
  55.         in X (it has to be a capital X).
  56.         You may enter a function in X on both sides of the "=", if
  57.         you enter a function in X only, Solver tries to find a 
  58.         value for X which gives f(X)=0.
  59.  
  60.         In the second icon 'Lower Limit' you have to enter the
  61.         lower limit for X.
  62.         In the third icon 'Upper Limit' you have to enter the upper
  63.         limit for X.
  64.  
  65.         If you press return in the third icon or click on 'Perform'
  66.         !Solver will try to find a value for X between the upper
  67.         and lower limit for which the equation is true.
  68.  
  69.         If there is more than one value of X for which the equation
  70.         is true !Solver will only find one of them.
  71.         To make sure there are no more solutions you could fiddle
  72.         the limits a bit but some mathematical insight would come
  73.         in handy here.
  74.         In most cases though if you move the limit nearest to the
  75.         answer towards to the other limit in such a way that the
  76.         found answer now lies just outside the limits then chances
  77.         are Solver will find another answer.
  78.  
  79.         After you have started the Solver, the 'Perform' icon will
  80.         change to 'Interrupt'.
  81.         If you click on 'Interrupt' Solver will stop and you may
  82.         then change the limits or the equation.
  83.  
  84.         During the Solving process you can monitor it's progres in
  85.         the three icons in the second box.
  86.         The first icon 'Evaluating' gives the value under test,
  87.         while the second icon 'Deviation' gives the deviation from
  88.         the correct answer.
  89.         The third icon 'Messages' reports any errors that might
  90.         occur during the process and also tells you when it is
  91.         finished.
  92.  
  93.         When Solver has found an answer the 'Messages' icon will
  94.         say "Found after ... iterations" and the answer will be in
  95.         the 'Evaluating' icon.
  96.  
  97.         If Solver can not find an answer, that means  no answer
  98.         with a zero deviation, it will stop after 160 iterations
  99.         and the 'Messages' icon will report this to you.
  100.         After this the 'Evaluating' icon will display an answer but
  101.         is has a deviation as shown in the 'Deviation' icon.
  102.           
  103.         If you click on 'Interrupt' during the solving process, the
  104.         'Messages' icon will say "Halted after ... iterations" and
  105.         the 'Evaluating' and 'Deviation' icon display the progress
  106.         so far.
  107.         If you click on 'Perform' after this the solving process
  108.         will start all over again.
  109.         It is not a resume but a restart.
  110.  
  111.  
  112.  
  113.         Using !Solver as a Evaluator_______________________________
  114.  
  115.         You may also use !Solver as a straight Evaluator.
  116.  
  117.         To do so click on the 'Solve' icon, it will change to
  118.         'Evaluate' and the 'Messages' icon will say "Evaluate
  119.         mode".
  120.  
  121.         After this you may enter a function in X in the 'Equation
  122.         in X' icon.
  123.         The 'Lower Limit' and 'Upper Limit' icons have a slightly
  124.         different use now.
  125.         In the 'Lower Limit' icon you may enter an initial value for
  126.         X while the 'Upper Limit' icon must contain a step value.
  127.  
  128.         Now each time you click on the 'Perform' icon, the function
  129.         will be evaluated for X='Lower Limit' and 'Upper Limit'
  130.         is added to 'Lower Limit' afterwards.
  131.         The 'Evaluating' icon gives the evaluated value of X as
  132.         always, but the 'Deviation' icon now gives the result.
  133.  
  134.         Use the interactive Help application from the applications
  135.         disc 1 if you want any help when using !Solver.
  136.  
  137.  
  138.  
  139.         Using the library__________________________________________
  140.  
  141.         The library functions may be used in exactly the same way
  142.         as Basic functions.
  143.         To find out how many functions there are and what they do try
  144.         the folowing.
  145.         Put !Solver in the Evaluation mode and enter into the three
  146.         writable icons.
  147.  
  148.             Equation in X > FNFunctionInfo(X)
  149.             Lower Limit   > -2
  150.             Upper Limit   > 1
  151.  
  152.         Clicking on the 'Perform' icon causes the 'Messages' icon to
  153.         display information about the function library.
  154.         Keep doing this until no further messages are displayed.
  155.  
  156.  
  157.  
  158.         Extending the library______________________________________
  159.  
  160.         You may add your own routines to the function library, but
  161.         some rules must be obeyed.
  162.         These rules can be found in the library header.
  163.         Also if you make any worthwhile additions, I would like to
  164.         receive a copy from you to be incorporated into later
  165.         releases of !Solver in the true spirit of shareware.
  166.  
  167.  
  168.  
  169.         How it works_______________________________________________
  170.  
  171.         !Solver works with the relatively simple methode of
  172.         successive halving
  173.  
  174.         It takes the right side of the equation, brackets it,
  175.         subtracts it from the left side of the equation and tries
  176.         to find a value for X for which the resulting function
  177.         becomes zero.
  178.  
  179.            g(X)=f(X) ==> g(X)-{f(X)}=0 
  180.  
  181.         After that a test is made to see if one of the limits has a
  182.         negative result and if so than that limit is taken as the
  183.         lower limit.
  184.  
  185.         Now it just takes the mean from the upper and lower limit
  186.         and tests it.
  187.         If the result is negative we found a new lower limit
  188.         otherwise we found a new upper limit.
  189.         This process just goes on until we reach a zero result.
  190.  
  191.         The reason that Solver always stops after 160 iterations is
  192.         that every possible answer should have been found by then.
  193.         This fact can be proven by the following.
  194.  
  195.         Solver uses Basic floating point numbers to evaluate the
  196.         given equation and these have the folowing range and
  197.         accuracy.
  198.             range    -1.7x10^38 to 1.7x10^38 (-1.7E38 to 1.7E38)
  199.             accuracy  1  x10^-9              (1E-9)
  200.  
  201.         This means there are 
  202.  
  203.             ([most positive]-[most negative])/[accuracy]
  204.  
  205.         definite points in this range.
  206.  
  207.         To find how many times we have to halve this range to end
  208.         at a definite point, we calculate which power of two gives
  209.         the same value as (pos-neg)/acc.
  210.  
  211.             2^i=(pos-neg)/acc
  212.  
  213.         To solve this we need some trigonometry.
  214.  
  215.             log(2^i) = log((pos-neg)/acc)
  216.  
  217.             i*log(2) = log(pos-neg)-log(acc)
  218.  
  219.                    i = {log(pos-neg)-log(acc)}/log(2)
  220.  
  221.         So, to find i from Basic we need to evaluate
  222.  
  223.             i=(LOG(3.4E38)-LOG(1E-9))/LOG(2)
  224.  
  225.         Sadly this is too much for Basic and it gives a 'Number too
  226.         big' error.
  227.         Time for another trick, we divide both the range and the
  228.         accuracy by two.
  229.         This gives the same number of definite points but the log
  230.         arguments stay within range.
  231.         Now we evaluate:
  232.  
  233.             i=(LOG(1.7E38)-LOG(2E-9))/LOG(2)
  234.  
  235.         If you enter the right part of this in the Solver and
  236.         Evaluate it the answer will be 155.89.... which is almost
  237.         accurate because it should be 157.89.... 
  238.  
  239.         And I think that should conclude our maths for this moment.
  240.  
  241.  
  242.  
  243.         Alternative solving methods________________________________
  244.  
  245.         There are a number of other methods to find a zero crossing
  246.         for a given function, most notably Newton Raphson and
  247.         Regula Falsi.
  248.         They both converge a lot faster than successive halving but
  249.         both have drawbacks as well.
  250.  
  251.  
  252.         Newton Raphson works by iteration of the folowing lines:
  253.  
  254.             y=x-f(x)/f'(x)
  255.             x=y
  256.  
  257.         As you can see it needs the first derivative to be
  258.         determined and has to evaluate two functions in every
  259.         iteration.
  260.  
  261.  
  262.         Regula Falsi works by iteration of the folowing lines:
  263.  
  264.             y=x1-((x1-x0)/f(x1)-f(x0))*f(x1)
  265.             x0=x1
  266.             x1=y
  267.  
  268.         As you can see a lot more calculations are needed, but with
  269.         some clever coding only one function evaluation is
  270.         neccessary for every iteration.
  271.  
  272.         Personally I did not feel the need to implement one of these
  273.         methods into !Solver.
  274.         If you have written a working version suitable for
  275.         incorporation in !Solver I would like to hear from you.
  276.  
  277.  
  278.  
  279.         Acknowledgements___________________________________________
  280.  
  281.         Thanks to:
  282.           -Joris Roling for his !Help application (you are probably
  283.            staring at that right now).
  284.           -Freddy Huttner for his excellent !NewModes module.
  285.            (the 56Hz 896x360x16 mode is great to work with).
  286.           -Acorn for developing this tremendous machine.
  287.           -My girlfriend for putting up with so much lack of
  288.            attention.
  289.           -And all others I forgot to mention.
  290.  
  291.  
  292.  
  293.         Terms of Use_______________________________________________
  294.  
  295.         You may freely copy as long as:
  296.           -all files in this application directory are included.
  297.           -this is not for commercial purposes
  298.           -you do not charge for copying.
  299.           -you do not put this program or parts of it on a disc for
  300.            which you are charging (other than the costs of the disc
  301.            itself).
  302.           -the application is not tampered with.
  303.           -this Readme file is always included without any change
  304.            made to its contents.
  305.           -you do not upload this on a bulletin board which charges
  306.            for its downloads.
  307.  
  308.         The author reserves the right to amend these terms in cases
  309.         where he deems misuse.
  310.  
  311.  
  312.  
  313.         Release information________________________________________
  314.  
  315.         v1.00 (26-12-90) First release (for selected persons only)
  316.         v1.10 (04-01-91) Library added.
  317.  
  318.  
  319.  
  320.         Correspondence_____________________________________________
  321.  
  322.         Send remarks, bugs and praise to:
  323.  
  324.           Duco Fennema
  325.           Eursingerweg 34
  326.           9411 BB  BEILEN
  327.           HOLLAND
  328.  
  329.           Telephone: 
  330.           05930-22277
  331.  
  332.           From outside Holland:
  333.           <International entry code> 031 5930 22277
  334.  
  335.