home *** CD-ROM | disk | FTP | other *** search
/ Club Amiga de Montreal - CAM / CAM_CD_1.iso / files / 560.lha / ICalc_v1.1 / icalc.doc < prev    next >
Text File  |  1991-09-19  |  28KB  |  859 lines

  1.  
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.  
  12.  
  13.  
  14.  
  15.                                ›3micalc ›0m›1mversion 1›0m.›1m1 
  16.  
  17.  
  18.  
  19.                       ›0mA complex-number expression parser 
  20.  
  21.                                by Martin W.Scott 
  22.  
  23.  
  24.  
  25.                                   User Guide 
  26.  
  27.  
  28.  
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54.  
  55.  
  56.  
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.      icalc                         User Guide                         icalc
  69.  
  70.  
  71.      ›1mIntroduction 
  72.  
  73.           ›0m›3micalc  ›0mis  a  terminal-based  calculator;  the  ›1mi ›0mstands for
  74.           ›1mimaginary›0m, denoting the fact that the calculator works  with
  75.           complex numbers.  There are many calculator programs for the
  76.           Amiga, but to my knowledge, none with this ability.  
  77.  
  78.  
  79.      ›1mComplex Numbers 
  80.  
  81.           ›0mA  complex number is made up of two components: a real part,
  82.           and an imaginary part.  The imaginary part is  just  a  real
  83.           number  multiplied by the special number i, which is defined
  84.           to be the square root of -1.  Thus, i*i = -1. This  may  all
  85.           seem very artificial, but it's not; complex numbers exist as
  86.           surely as  real  numbers  do (or don't).  It's just that our
  87.           notion of a real number is based upon our much experience of
  88.           measurement and arithmetic.  If  fact,  given  an  arbitrary
  89.           length  of string, we probably couldn't calculate its length
  90.           as a real number, but only find a rational approximation  to
  91.           it.   However,  it is not the purpose of this guide to teach
  92.           the basics of complex numbers - there are  plenty  of  books
  93.           that do  that.    But  even if you've never heard of complex
  94.           numbers before, you may still  find  ›3micalc  ›0museful,  because
  95.           real  numbers  are just a subset of complex numbers, and can
  96.           thus be manipulated  by  this  program  as  in  an  ordinary
  97.           calculator-type program.    Don't be put off - I hardly ever
  98.           need to use complex numbers, I just like the facility to  be
  99.           there for the odd occasion when I do use them.  
  100.  
  101.  
  102.      ›1mExpressions 
  103.  
  104.           ›0m›3micalc  ›0maccepts  expressions  in  the usual form for computer
  105.           expressions, i.e.  multiplication must be  explicitly  shown
  106.           by  '*', and function arguments enclosed within parentheses.
  107.           The exception to this is the method  of  inputing  imaginary
  108.           parts of complex numbers.  If you want to enter the number 3
  109.           + 4i, you can type either 
  110.  
  111.               3 + 4i 
  112.  
  113.           or 
  114.  
  115.               3 + 4*i 
  116.  
  117.           but ›3mnot 
  118.  
  119.               ›0m3 + i4 
  120.  
  121.           since  this  would  give an ambiguous grammar - is it i*4 or
  122.           the variable "i4"?  
  123.  
  124.           In  almost  all  circumstances,  the   algebraic   "4i"   is
  125.           preferred, but there is one exception, exponentation "^". If
  126.           you want 3*i^3, you must type 
  127.  
  128.               3*i^3 
  129.  
  130.  
  131.      icalc                            -2-                       version 1.1
  132.  
  133.  
  134.      icalc                         User Guide                         icalc
  135.  
  136.  
  137.           and not 
  138.  
  139.               3i^3 
  140.  
  141.           The  former gives the correct result, -3i, whilst the latter
  142.           gives -27i. This is because  the  grammar  sees  "3i"  as  a
  143.           number   in   its   own   right,   and   not   an   implicit
  144.           multiplication.  
  145.  
  146.           See the  appendices  for  the  complete  list  of  commands,
  147.           operators,   constants  and  builtin  functions  that  ›3micalc
  148.           ›0msupports.   Expressions  are  separated   by   newlines   or
  149.           semi-colons  ';'.  You  may  also  split  an expression over
  150.           multiple  lines  using   a   backslash   '\'   to   indicate
  151.           continuation to   the   next   input  line.    Comments  are
  152.           introduced by '#',  and  the  rest  of  the  input  line  is
  153.           ignored.  You may also place comments after backslashes.  
  154.  
  155.  
  156.      ›1mSample Expressions 
  157.  
  158.  
  159.               ›0mx=1-i # an assignment statement 
  160.  
  161.           assigns to variable x the value 1-i.  
  162.  
  163.               # and now, two statements separated by a semi-colon 
  164.  
  165.               sqr(x); x*sqr(x); 
  166.  
  167.           displays   the  values  -2i  and  -2-2i.  The  next  example
  168.           demonstrates a problem inherent in machine calculations: 
  169.  
  170.               2*sin(x)*cos(x) - sin(2*x) 
  171.  
  172.           displays the value 4.4408920985e-16  +  4.4408920985e-16  i.
  173.           The  answer  should  be 0, and indeed is very close to that.
  174.           The inaccuracy results because each  term  has  a  value  as
  175.           close  to  the  actual  value  as  the  computer's  internal
  176.           representation of numbers can hold.  
  177.  
  178.  
  179.      ›1mStarting icalc 
  180.  
  181.           ›0m›3micalc ›0mmay be started from either the CLI  or  Workbench.  It
  182.           will  process  the  the  file  "s:icalc.init"  if it exists,
  183.           before doing anything else.  It is recommended that you  use
  184.           NEWCON:   or   ConMan   to   provide   editing  and  history
  185.           facilities.  
  186.  
  187.        CLI Usage 
  188.  
  189.           The synopsis for icalc is 
  190.  
  191.               icalc [file-list] 
  192.  
  193.           where file-list is a list of input files.  ›3micalc  ›0mwill  read
  194.           (process) the files in the list and exit.  If a file-list is
  195.  
  196.  
  197.      icalc                            -3-                       version 1.1
  198.  
  199.  
  200.      icalc                         User Guide                         icalc
  201.  
  202.  
  203.           specified, ›3micalc ›0mwill assume that you do not wish to use the
  204.           program interactively.  If you do, you should specify one of
  205.           the files as a dash "-"; this is taken to mean "use standard
  206.           input".    If   no  file-list  is  given,  ›3micalc  ›0mstarts  an
  207.           interactive session.  You can obviously redirect output to a
  208.           file if you wish (and redirect input from a file,  but  this
  209.           is generally  unnecessary).    For example, if you wanted to
  210.           use definitions contained in a file called "stat.icalc", and
  211.           then type some expressions in at the terminal, you would use 
  212.  
  213.               icalc stat.icalc - 
  214.  
  215.           to start the program.  Because the program  makes  extensive
  216.           use  of recursion, I recommend you use a stack size of about
  217.           20K when running ›3micalc.  
  218.  
  219.        ›0mWorkbench Usage 
  220.  
  221.           To start ›3micalc ›0mfrom the Workbench, simply  double-click  its
  222.           icon.   You  may  also  pass  arguments  (definition/command
  223.           files) to ›3micalc ›0min the usual Workbench manner  (shift-select
  224.           etc.).   ›3micalc  ›0mwill  then  open  a  window on the Workbench
  225.           screen for an interactive session.    You  can  specify  the
  226.           window  to be opened by modifying the WINDOW tooltype (click
  227.           once on the ›3micalc ›0micon, and select "Info" from the Workbench
  228.           menu).  By default, this is a NEWCON: window.  
  229.  
  230.           You may also set the default tool  of  a  definition  file's
  231.           project icon  to  be ›3micalc.  ›0mThen simply double clicking the
  232.           project icon will  launch  ›3micalc  ›0mand  read  the  definition
  233.           file.  Remember, however, to set the project icon's stack to
  234.           20000, or you may get a stack overflow error.  
  235.  
  236.        Exiting icalc 
  237.  
  238.           To  end  an interactive session of ›3micalc ›0m(from either CLI or
  239.           Workbench) use the commands "quit" or "exit".  You can  also
  240.           type ^\ (press the control key and '\' simultaneously).  
  241.  
  242.  
  243.      ›1mVariables 
  244.  
  245.           ›0mVariables  in  ›3micalc ›0mcan be named arbitrarily, as long as no
  246.           name conflicts with a pre-defined symbol name, such  as  sin
  247.           or  PI.  The standard conventions apply: the first character
  248.           must be a letter or underscore,  followed  by  a  string  of
  249.           letters, digits and underscores.  Case is significant.  
  250.  
  251.           Variables  are  introduced  by  using them; If a variable is
  252.           used before it has been initialized (i.e. has  had  a  value
  253.           assigned  to it), ›3micalc ›0mwill warn the user and use the value
  254.           zero.  Assignments can appear anywhere in an expression, and
  255.           are in fact expressions  in  their  own  right  (as  in  the
  256.           programming language C).  So, you can do things like 
  257.  
  258.               apple = banana = apricot = 34 
  259.  
  260.           to assign   the   value   34  to  these  variables.    Since
  261.  
  262.  
  263.      icalc                            -4-                       version 1.1
  264.  
  265.  
  266.      icalc                         User Guide                         icalc
  267.  
  268.  
  269.           assignments  are  expressions,   their   value   being   the
  270.           assignment value, you can also do 
  271.  
  272.               apple = sqr(banana = 12) 
  273.  
  274.           which  assigns the value 12 to "banana", and 144 to "apple".
  275.           You can of course assign new values to existing variables.  
  276.  
  277.  
  278.      ›1mConstants and ans 
  279.  
  280.           ›0m›3micalc ›0mcomes with several predefined  constants,  e.g.    PI,
  281.           GAMMA etc,  which  by convention are all in upper-case.  You
  282.           cannot assign a new value to a constant.  There is a special
  283.           constant, "ans", which isn't really a constant at  all,  but
  284.           is made so to prevent assignments to it.  "ans" contains the
  285.           value  of  the  previously  evaluated  expression, and so is
  286.           useful when splitting a calculation up into smaller chunks.  
  287.  
  288.               1 + 2 + 3 
  289.                           6 
  290.  
  291.               ans * 12 
  292.                           72 
  293.  
  294.           You can also use it for recursive formulas.    For  example,
  295.           the logistic equation xnext = rx(1-x) for parameter r = 3.5,
  296.           initial x = 0.4 could be iterated as follows: 
  297.  
  298.               r = 3.5; 0.4 # initialize r and ans 
  299.                           3.5 
  300.                           0.4 
  301.  
  302.               r*ans*(1-ans) 
  303.                           0.84 
  304.  
  305.               r*ans*(1-ans) 
  306.                           0.4704 
  307.  
  308.               r*ans*(1-ans) 
  309.                           0.87193344 
  310.  
  311.               r*ans*(1-ans) 
  312.                           0.390829306734 
  313.  
  314.           and so on.  Of course, you needn't use "ans" here; you could
  315.           just  use  assignments to "x", but it illustrates the point.
  316.           Note  that  once   the   necessary   variables   have   been
  317.           initialised,  the  same  expression is evaluated repeatedly.
  318.           Thus, if you are using a window  with  history  capabilities
  319.           (such as NEWCON:) you can save a lot of typing.  
  320.  
  321.           There  are  other  ways  to perform repeated calculations in
  322.           ›3micalc.   ›0mThese  are  explained  in  the   section   "Special
  323.           Functions".  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.      icalc                            -5-                       version 1.1
  330.  
  331.  
  332.      icalc                         User Guide                         icalc
  333.  
  334.  
  335.      ›1mBuiltin Functions 
  336.  
  337.           ›0m›3micalc  ›0mcomes  with  many builtin functions, for example sin,
  338.           cos, sqrt, exp, ln etc.  There are  some  special  functions
  339.           for complex  numbers  too,  namely  Im,  Re, arg, norm.  All
  340.           functions take real or complex arguments, which can  be  any
  341.           expression.  For example, 
  342.  
  343.               asin(sin(1)) 
  344.  
  345.           returns the value 1 as expected.  But ...  
  346.  
  347.               asin(sin(1-i)) 
  348.  
  349.           returns  1.484116283319  - 0.831157682449 i; this is because
  350.           the inverse of sin is a many-valued function.  asin  returns
  351.           a  value  in  the  PVR  (principal  value  range)  as do all
  352.           many-valued functions in ›3micalc.  ›0mThe  PVR  is  defined  (for
  353.           this program)  as  the interval [-PI,PI).  When working with
  354.           complex numbers, you should always bear in mind that  almost
  355.           all  the  trigonometric  functions  are many-valued, because
  356.           they are defined in terms of the exponential and logarithmic
  357.           functions.  Another thing to bear  in  mind  if  you  intend
  358.           working with reals is that things like 
  359.  
  360.               ln(-1) 
  361.  
  362.           return a value, 3.14159265359 i (PI*i) in this case.  
  363.  
  364.  
  365.      ›1mUser›0m-›1mdefined Functions 
  366.  
  367.           ›0mUser-defined   functions  give  ›3micalc  ›0mits  flexibility  and
  368.           power.   Any  function  that  can  be  stated  as  a  normal
  369.           expression  (or  list  of expressions) may easily be defined
  370.           and used like a builtin function.  Functions are defined  in
  371.           the following manner: 
  372.  
  373.               func <name> ( <parameter-list> ) = <expr> 
  374.  
  375.           so to define the function f(z) = sin(sqrt(z)), simply type 
  376.  
  377.               func f(z) = sin(sqrt(z)) 
  378.  
  379.           Note  that  z  is  ›3mlocal  ›0mto  the  function,  not  a  global
  380.           variable.  Thus, if z has been defined as a variable  before
  381.           defining f(z),  it  is  unaltered when you call f(z).  There
  382.           are a  number  of  sample  definition  files  included  with
  383.           ›3micalc.  ›0mYou may find it instructive to examine them.  
  384.  
  385.           Multi-parameter functions may also be defined.  For example,
  386.           the volume of a right-circular cone is given by the formula 
  387.  
  388.               volume = 1/3*PI*sqr(r)*h 
  389.           where  r  is  the radius of the base, and h is the height of
  390.           the cone.  We can define a function to compute the volume as
  391.           follows: 
  392.  
  393.  
  394.  
  395.      icalc                            -6-                       version 1.1
  396.  
  397.  
  398.      icalc                         User Guide                         icalc
  399.  
  400.  
  401.               func conevol(r,h) = 1/3*PI*sqr(r)*h 
  402.  
  403.               conevol(1,3) 
  404.                           3.14159265 
  405.  
  406.           It is also possible  (though  of  limited  use)  to  declare
  407.           functions that    take   no   parameters.      Examples   of
  408.           multi-parameter functions are given in the sample definition
  409.           files.  
  410.  
  411.           As with most programming  languages,  don't  write  circular
  412.           definitions;  ›3micalc  ›0mdoes  not detect them, and will swiftly
  413.           run out of stack space.  Recursive functions fall into  this
  414.           category, as there is no way to specify terminal cases.  
  415.  
  416.  
  417.      ›1mSpecial Functions 
  418.  
  419.           ›0mCertain  builtin  functions  in  ›3micalc  ›0mare  called  ›3mspecial
  420.           ›0mbecause of the way they use their arguments.  Normally, when
  421.           you `call' a function, its arguments are first evaluated and
  422.           then the  function  is  called.    With  special   functions
  423.           however,  the  arguments  are not evaluated; this means that
  424.           the expressions themselves (and not just their  values)  can
  425.           be used  by  the function in a number of ways.  Some special
  426.           functions take integers  as  arguments;  if  you  supply  an
  427.           expression  with  a  non-integral  value, this value will be
  428.           stripped of it's imaginary component, and the remaining real
  429.           number rounded to  the  nearest  integer.    Currently,  the
  430.           special functions are as follows.  
  431.  
  432.        Sum(var,upto,expr) 
  433.  
  434.           This command  calculates finite sums.  The variable `var' is
  435.           the index of summation, with an optional assignment.   While
  436.           the value of the index is less than or equal to the value of
  437.           the upto argument, the value of expr is added to an internal
  438.           summation variable,  which is initially zero.  Examples will
  439.           help to clarify usage.  
  440.  
  441.           To evaluate  the  sum  of  the  first  100  natural  numbers
  442.           (naively) we could do 
  443.  
  444.               Sum(n=1,100,n) 
  445.  
  446.           which  gives  the  answer  as 5050 (which is 100/2*(100+1)).
  447.           Note the initial assignment of 1 to n.  If no initial  value
  448.           is  specified,  a  value of zero is assumed (and the user is
  449.           notified of this).  When a summation is complete, the  index
  450.           variable holds a value 1 greater than the value of upto.  We
  451.           can  also  use  Sum()  to provide approximations to infinite
  452.           sums.  
  453.  
  454.               Sum(n=1, 100, 1/sqr(n)) 
  455.                           1.6349839 
  456.  
  457.           Using the fact that n will now hold the value  101,  we  can
  458.           continue the summation to 200 by the following: 
  459.  
  460.  
  461.      icalc                            -7-                       version 1.1
  462.  
  463.  
  464.      icalc                         User Guide                         icalc
  465.  
  466.  
  467.               ans + Sum(n, n+99, 1/sqr(n)) 
  468.                           1.63994655 
  469.  
  470.           and  continue to obtain closer answers by repeating the last
  471.           line, 
  472.  
  473.               ans + Sum(n, n+99, 1/sqr(n)) 
  474.                           1.64160628 
  475.  
  476.           One last example, to  evaluate  the  sum  of  the  all  even
  477.           numbers upto 100.  
  478.  
  479.               Sum(n=1, 50, 2*n) 
  480.                           2550 
  481.  
  482.        Prod(var,upto,expr) 
  483.  
  484.           This command calculates finite products, in an analogous way
  485.           to the  Sum()  special  function.  Examples will demonstrate
  486.           its use.  
  487.  
  488.               Prod(n=1, 10, n) 
  489.  
  490.           calculates 10!, which is 3628800. We can also use Prod()  to
  491.           investigate  infinite  products,  although  care  should  be
  492.           taken.  Consider Wallis's product for PI/2: 
  493.  
  494.               PI      2×2×4×4×6×6×...
  495.               --   =  ---------------
  496.               2       1×3×3×5×5×7×...
  497.  
  498.           Here the product is 2/1 * 2/3 * 4/3 * 4/5 * ...  and  so  we
  499.           must   find   a  method  of  producing  the  numerators  and
  500.           denominators from an index.  It is easiest to  evaluate  the
  501.           product in  pairs  of  terms.    Thus,  for  each  term  our
  502.           numerator will be sqr(2*n),  and  our  denominator  will  be
  503.           (2*n-1)*(2*n+1) = sqr(2*n)-1.  Note that sqr(2*n) appears in
  504.           both the  numerator  and  denominator.    We  can  therefore
  505.           optimise the calculation by using a  temporary  variable  to
  506.           hold this value.  We proceed as follows: 
  507.  
  508.               Prod(n=1, 100, (t = sqr(2*n))/(t-1)) 
  509.                           1.56689375 
  510.  
  511.               ans * Prod(n, n+99, (t = sqr(2*n))/(t-1)) 
  512.                           1.56883895 
  513.  
  514.               ans * Prod(n, n+99, (t = sqr(2*n))/(t-1)) 
  515.                           1.56949005 
  516.  
  517.        every(var,upto,expr) and vevery(var,upto,expr) 
  518.  
  519.           These  functions  perform more general iterations than Sum()
  520.           and Prod().  They return the value of  the  last  expression
  521.           evaluated, ie.   expr  evaluated  when  var  =  upto.    The
  522.           difference between every() and vevery() is that  the  latter
  523.           produces  verbose  output - it prints the value of the index
  524.           and the result of the expression for every iteration.  
  525.  
  526.  
  527.      icalc                            -8-                       version 1.1
  528.  
  529.  
  530.      icalc                         User Guide                         icalc
  531.  
  532.  
  533.           Example:  evaluate   sin(sin(...(sin(z))...))   with   sin()
  534.           applied 10 times.  Here we'll take z to be 1-i.  
  535.  
  536.               last = 1-i; every(n=1, 10, last = sin(last)) 
  537.                           0.51856952 - 0.01039404 i 
  538.  
  539.           Although every() and vevery() are useful in some situations,
  540.           most iterations are more easily performed by using Sum() and
  541.           Prod(). 
  542.  
  543.        multi(expr1, expr2, ... , exprN) 
  544.  
  545.           This   special   function   takes  an  arbitrary  number  of
  546.           arguments, and evaluates each of them from  left  to  right.
  547.           It returns  the value of it's last argument, exprN.  multi()
  548.           was added to make the  addition  of  certain  user-functions
  549.           possible.    For   example,   the  one-variable  statistical
  550.           analysis suite given in the file "stat.icalc"  uses  multi()
  551.           to  update  the  values  of many variables with one function
  552.           call.  If output has not been switched off with  the  silent
  553.           command,  a  call  to  multi() will print the result of it's
  554.           last argument.  In order  to  print  the  results  of  other
  555.           arguments,   the   builtin  function  print()  is  supplied.
  556.           print() takes one argument, prints it to  the  display,  and
  557.           returns its  argument as a result.  In this way, expressions
  558.           can appear to return more than one result.  
  559.  
  560.           An  example:  write  a  function  that  converts   Cartesian
  561.           coordinates  into polar form, returning the radius and angle
  562.           in degrees, as well as setting the variables r and theta  to
  563.           these values.  
  564.  
  565.  
  566.               func rec2pol(x,y) = multi(r = print(sqrt(x*x+y*y)), \ 
  567.                           theta = DEG*atan(y/x) ) 
  568.  
  569.  
  570.               rec2pol(3,4) 
  571.                           5 
  572.                           53.13010235 
  573.  
  574.  
  575.           Examples  of the many uses of these special functions can be
  576.           found in the example icalc script file "stat.icalc" and  the
  577.           startup file "icalc.init".  
  578.  
  579.  
  580.      ›1mCommands 
  581.  
  582.           ›0m›3micalc ›0mhas a few commands to make life easier.  
  583.  
  584.        quit 
  585.        exit 
  586.           not surprisingly, these commands terminate ›3micalc.  
  587.  
  588.        ›0msilent 
  589.           stops generation of any further output.  However, errors and
  590.           warnings are   still   displayed.      It   is   useful  for
  591.  
  592.  
  593.      icalc                            -9-                       version 1.1
  594.  
  595.  
  596.      icalc                         User Guide                         icalc
  597.  
  598.  
  599.           initialization files containing lots of definitions.  
  600.  
  601.        verbose 
  602.           restores generation of output.  
  603.  
  604.        help 
  605.           reminds you what other commands are available.  
  606.  
  607.        vars 
  608.           lists all currently defined variables and their values.  
  609.  
  610.        consts 
  611.           lists all predefined constants and their values.  
  612.  
  613.        builtins 
  614.           lists all built-in functions  available,  including  special
  615.           functions.  
  616.  
  617.        functions 
  618.           lists  all  user-defined  functions,  with  their  parameter
  619.           lists.  
  620.  
  621.  
  622.      ›1mBugs 
  623.  
  624.           ›0mWhat bugs?  Well, I'm sure there must be the odd one or two,
  625.           but I haven't noticed.  Should you find any, please  let  me
  626.           know and  I'll  try  to  fix them.  If there's something you
  627.           hate about ›3micalc ›0mand would like changed,  again  drop  me  a
  628.           line (at the address below).  
  629.  
  630.  
  631.      ›1mCompiling 
  632.  
  633.           ›0m›3micalc ›0mwas written using Lattice C (version 5.10a) but should
  634.           compile  with  no problems with Manx C. I use the version of
  635.           bison on Fish #136; if you're using a later version or Yacc,
  636.           you may need to change the makefile.  
  637.  
  638.           The code is meant to be  portable,  so  Amiga-specific  code
  639.           (there's  not  much)  is  #ifdef'd.  Also,  to implement the
  640.           WINDOW tooltype, I've used a slightly  modified  version  of
  641.           Lattice's  _main  function; since I'm probably not permitted
  642.           to distribute the modified source, I've  included  just  the
  643.           compiled module, myumain.o.  
  644.  
  645.  
  646.      ›1mCredits 
  647.  
  648.           ›0mThanks  to  the GNU team for bison (it makes these things so
  649.           much easier to write and modify) and to William  Loftus  for
  650.           the Amiga port.  
  651.  
  652.           Thanks  also  to  Steve Koren for Sksh, and Mike Meyer et al
  653.           for  Mg3;   together   they   make   a   great   development
  654.           environment.  
  655.  
  656.  
  657.  
  658.  
  659.      icalc                            -10-                      version 1.1
  660.  
  661.  
  662.      icalc                         User Guide                         icalc
  663.  
  664.  
  665.           This  is  my  first  bison-based project, and I learnt a lot
  666.           from "The Unix Programming Environment" by  Brian  Kernighan
  667.           and Rob Pike. Their "hoc" taught me a lot about using Yacc.  
  668.  
  669.  
  670.      ›1mDistribution 
  671.  
  672.           ›0m›3micalc ›0mis not public domain.  You are permitted to distribute
  673.           it at  only  a  nominal  charge  to  cover costs.  All files
  674.           should be included, with the exception of the  source  files
  675.           (in the  "src"  directory).  Under no circumstances should a
  676.           modified version of ›3micalc  ›0mbe  distributed.    If  you  make
  677.           modifications  which  you feel may be useful, send a copy to
  678.           me and I'll (probably) include them with the next release.  
  679.  
  680.  
  681.      ›1mThe Bottom Line 
  682.  
  683.           ›0mAlthough contributions are not required, they would be  most
  684.           welcome (I'm  a  poor  student).  Don't let that inhibit you
  685.           from sending bug reports, praise, suggestions, neat programs
  686.           etc.  I'd get most pleasure from hearing if anyone  actually
  687.           uses this bloody program!  
  688.  
  689.           I can be reached at: 
  690.  
  691.               Martin W. Scott,
  692.               23 Drum Brae North,
  693.               Edinburgh, EH4 8AT
  694.               SCOTLAND.
  695.  
  696.           Thanks for reading this far. The appendices follow.
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.  
  723.  
  724.  
  725.      icalc                            -11-                      version 1.1
  726.  
  727.  
  728.      icalc                         User Guide                         icalc
  729.  
  730.  
  731.      ›1mAppendix 1 ›0m- ›1mOperators ›0m(›1min increasing order of precedence›0m)     
  732.  
  733.           =        assignment
  734.           +        addition
  735.           -        subtraction, unary minus
  736.           *        multiplication
  737.           /        division
  738.           ^        exponentation
  739.           '        conjugate: z' = conjugate of z
  740.  
  741.  
  742.      ›1mAppendix 2 ›0m- ›1mConstants      
  743.  
  744.           ›0mPI       4*atan(1) (that's one definition)
  745.           E        exp(1)
  746.           GAMMA    Euler's constant, 0.57721566...
  747.           DEG      Number of degrees in one radian
  748.           PHI      Golden ratio 1.61803398...
  749.           LOG10    ln(10)
  750.           LOG2     ln(2)
  751.  
  752.  
  753.      ›1mAppendix 3 ›0m- ›1mBuiltin functions     
  754.  
  755.           ›0mSingle-argument functions:
  756.  
  757.           sin      trigonometric functions
  758.           cos
  759.           tan
  760.           asin     inverse trigonometric functions
  761.           acos 
  762.           atan
  763.           sinh     hyperbolic trigonometric functions
  764.           cosh
  765.           tanh
  766.           exp      exponential function
  767.           ln       natural logarithm
  768.           sqr      square
  769.           sqrt     square root
  770.           conj     conjugate (see also ' operator)
  771.           abs      absolute value (sqrt(norm(z))
  772.           norm     not really norm; if z=x+iy, norm(z) = x²+y²
  773.           arg      principal argument
  774.           Re       real part of complex number
  775.           Im       imaginary part of complex number
  776.           int      real and imaginary parts rounded to nearest integer
  777.           ceil     ceil of real and imaginary parts (eg. ceil(1.2) = 2)
  778.           floor    floor of real and imaginary parts (eg. floor(1.2) = 1)
  779.           print    prints and returns the value of its argument
  780.           prec     adjust number of decimal places displayed
  781.  
  782.           Special  functions (for more details, see the section headed
  783.           "Special Functions" above): 
  784.  
  785.           Sum      calculate a finite sum
  786.           Prod     calculate a finite product
  787.           every    perform a general iteration quietly
  788.           vevery   perform a general iteration verbosely
  789.  
  790.  
  791.      icalc                            -12-                      version 1.1
  792.  
  793.  
  794.      icalc                         User Guide                         icalc
  795.  
  796.  
  797.           multi    evaluate many expressions
  798.  
  799.  
  800.  
  801.  
  802.  
  803.  
  804.  
  805.  
  806.  
  807.  
  808.  
  809.  
  810.  
  811.  
  812.  
  813.  
  814.  
  815.  
  816.  
  817.  
  818.  
  819.  
  820.  
  821.  
  822.  
  823.  
  824.  
  825.  
  826.  
  827.  
  828.  
  829.  
  830.  
  831.  
  832.  
  833.  
  834.  
  835.  
  836.  
  837.  
  838.  
  839.  
  840.  
  841.  
  842.  
  843.  
  844.  
  845.  
  846.  
  847.  
  848.  
  849.  
  850.  
  851.  
  852.  
  853.  
  854.  
  855.  
  856.  
  857.      icalc                            -13-                      version 1.1
  858.  
  859.