home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / lifeos2.zip / LIFE-1.02 / EXAMPLES / GAUSS.DOC < prev    next >
Text File  |  1996-06-04  |  5KB  |  105 lines

  1.  
  2.                                
  3.                               GAUSS
  4.  
  5.           An  Incremental Solver for Linear Equations written in LIFE
  6.  
  7.  
  8.  1 How to use the solver ?
  9.  -------------------------
  10.  
  11.  First,needless to say, load it. You'll then have to start the solver.
  12.  In the most current case, at the moment when you start the solver, you
  13.  want to give hime immediately some equations to resolve. Here is the
  14.  way to do it :
  15.  starter([equation1,equation2...],Channel)?
  16.  
  17.    The "Channel" must be an uninstantiated variable. It will play the
  18.  role of a constraint queue, the mandatory passage for sending new
  19.  equations to the solver.
  20.    The equations are of any of the form described below, in the
  21.  normalization module. But don't bother to look through all the code,
  22.  here is the authorized formulae :
  23.       => All formulaes contructed with LIFE variables, numbers, and the
  24.          "+", "*", "-" and "~" symbols. The three formers have their
  25.          natural syntax (i.e. binary, infix, left-associative and the
  26.          such) and meaning. Note that they can't be used as unary
  27.          operators, although it's a very common usage. The "~" sign is
  28.          a representation of the unary minus.
  29.       => Two such expressions, each on one side of an equal sign.
  30.  
  31.  Note : The former are supposed to be equal to zero. The latter
  32.         behave in the obvious way.
  33.  
  34.  At this point, the reader/user may be puzzled by the fact that a
  35.  linear equation solver accepts any type of polynomial equations as
  36.  input. To be honest, the program behave in the following way :
  37.   - Even if your equation doesn't look linear, it will try to expand,
  38.   reduce and simplify it, in case all high degree terms could be
  39.   eliminated.
  40.   - If, after all its try, the normalizer can't turn your work into sum
  41.   of couples (I mean product) number/variable, it will fail, with a
  42.   polite note saying that your entry wasn't linear.
  43.  
  44.  I all has worked fine, the solver will treat your equations, and then
  45.  you'll be back to the usual LIFE environement, with strange values
  46.  assigned to your previously free variables. Note that (and, I know,
  47.  that's a pity) these values will be the only output of the solver.
  48.  
  49.   - The "Channel" variable : You don't have to worry about is value. It
  50.   should be something like q(@~). The tlda, as any experimented life
  51.   user will know, means that a function has residuate on this variable.
  52.   Don't worry : It is our solver itself, quietly waiting for you to
  53.   give him more equations.
  54.   - On the opposite, the values of the variables that has occured in
  55.   your equation is of great interest :  There you'll find the value, in
  56.   the mathematical sense, of your variable. The psi-term that is
  57.   associated with each variable looks like the following :
  58.  
  59.        X : vr(3,val=>[5*Y,-2*Z,765],wlist=>[]) 
  60.  
  61.  The sort "vr" for "variable" is just here on programming purpose, as
  62.  is the identifier (the first field, with value 3 in our exemple).
  63.  The attribute wlist won't give you very interesting hints either,
  64.  unless you worry about the conception of th program. The more
  65.  significant field is, for the user, the "val" field. If the variable
  66.  has a definite numeric value (deduced from the equation system), it
  67.  will be stored here, in a one element list ([42], for exemple). Else,
  68.  it will provide you with a linear function of other variables, which
  69.  is, in our former example, f(Y,Z)= 5Y - 2Z + 765. This function will
  70.  automatically be replaced by a more precise one, or eventually a
  71.  numeric value, when you'll give further information to the solver.
  72.  
  73.  
  74.  2 Feeding the Beast
  75.  -------------------
  76.  
  77.  The "Channel" variable will allow you to give additional equations,
  78.  that will be solved in the context defined by previous equations (i.e,
  79.  the partial or definitive values your variables have now). You could
  80.  do that "by hand", of course, by directly modifying the content of the
  81.  channel variable, but we won't encourage such a practice. We've made
  82.  for you two cute functions which theoretically do this job properly.
  83.  Their syntax is :
  84.  
  85.          feeder(equation,Channel)?
  86.          fast_feeder([eq1,eq2,...],Channel)?
  87.  They work exactly the same way, except that feeder wwill handle a
  88.  single equation while fast_feeder take a list of equation. Use
  89.  whichever you want.
  90.  By the way, you're perfectly free to put new variables in the
  91.  equations. The counter "varcount" will assure them to have different Id.
  92.  
  93.  What else to say ? Well, I think I've told the main points, on the
  94.  user point of view I mean.  So... enjoy !
  95.  
  96.  
  97.  Author: Christophe Bonnet
  98.  (c) Copyright 1992 Digital Equipment Corporation
  99.  All Rights Reserved
  100.  
  101.  I'll be glad to have any comments and feedback from those who may be
  102.  interested in  this small (but, I hope, interesting) program. Bug
  103.  reports will be -huh- useful, of course. And I'm alas pretty sure
  104.  there is plenty of those nasty animals in my code...
  105.