home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpmug / cpmug083.ark / MUMATH%.DOC < prev    next >
Encoding:
Text File  |  1984-04-29  |  12.0 KB  |  429 lines

  1.  
  2. MUMATH%.DOC   documentation for the muMATH files on this disk
  3.  
  4. These files are to be used with the muMATH/muSIMP symbolic
  5. mathematics system.  I will assume that anyone reading this
  6. has at least a minimal familiarity with that system.  The
  7. files have been named according to the usual muSIMP scheme to
  8. display their dependences upon each other.  Most of the files
  9. are intended as enhancements or replacements for files fur-
  10. nished with muMATH.  I recommend that you keep the original
  11. files and give the new files different names, since you may
  12. sometimes want to use the old version instead of the new one.
  13.  
  14. These files will allow many calculations to be done that could
  15. not be done with the original muMATH release.  When PBRCH is
  16. non-false (so that picking a branch for a multi-valued function
  17. is expected), the calculation of #I^(2/3) as 1/2 + 3^(1/2)*#I/2
  18. can be carried out.  Formulas for the solution of third and
  19. fourth degree equations are included.  Exact values of many
  20. more of the trig functions can be obtained; for example
  21. COS(#PI/16) and SIN(11*#PI/15).  Evaluation of the inverse
  22. trig functions are included, so that calculations like
  23. DEFINT(1/(1+X^2),X,MINF,PINF)  can be done (answer: #PI).
  24. Also,values for the error function have been added, so that
  25. DEFINT(#E^-X^2,X,MINF,PINF) can be calculated.  Many of the
  26. most common infinite series can be evaluated.
  27.  
  28. Most of the files furnished here cannot be loaded as-is by
  29. muSIMP.  I have included the character `%' in the names of
  30. such files: muSIMP will not load a file containing it unless
  31. the % is doubled.  Instructions for creating a RDS-able file
  32. from the %-file are contained at the beginning of the file.
  33. Normally this is involves merging the file with one of the old
  34. muMATH files, using a text editor.
  35.  
  36. Descriptions of the new files and/or the differences in the
  37. new versions are given below.  I have included many
  38. calculator-mode examples.  When you have loaded a new file,
  39. I recommend that you try at least a couple of the examples for
  40. that file to make sure it is working properly.
  41.  
  42. I would be interested in hearing from other users of muMATH,
  43. especially those who have written programs to do non-trivial
  44. mathematical tasks.  My address:  Gerald Edgar, 107 W. Dodridge
  45. St., Columbus, OH 43202.  Perhaps we can exchange programs
  46. (hard copy form, or even on disk - 8" CP/M only, please).
  47.  
  48. G. A. Edgar
  49. March 1, 1982
  50.  
  51. ============================================================
  52. ARITH.MUS
  53.  
  54. This file is a replacement for the existing ARITH.MUS.  The
  55. only difference is in evaluation of powers #I^R when PBRCH
  56. is non-false and the exponent is rational.  In that case,
  57. #I^R is replaced by a complex exponential.  Example:
  58.  
  59.      ? #I^(2/3);
  60.      @: #E ^ (#I*#PI/3)
  61.  
  62.      ? TRGEXPD: -7;
  63.      @: -7
  64.  
  65.      ? #I^(2/3);
  66.      @: #I*SIN(#PI/3) + COS(#PI/3)
  67.  
  68. With TRGNEG, we get:
  69.  
  70.      ? #I^(2/3);
  71.      @: 1/2 + 3^(1/2)*#I/2
  72.      
  73.  
  74. ============================================================
  75. SOLVE4.EQN
  76.  
  77. The file SOLVE4.EQN replaces SOLVE.EQN.  It was constructed by
  78. adding the formulas for third and fourth degree equations to
  79. SOLVE.EQN.  Usage is the same as described in the manual.  (In
  80. some of the following examples, the new version of ARITH.MUS
  81. has made a difference.)
  82.  
  83.      ? SOLVE(9*X^3-3*X^2-8*X+4==0,X);
  84.      @: {X == -1,
  85.          X == 2/3+5*#I/(3^(1/2)*6)-3^(1/2)*5*#I/18}
  86.  
  87.      ? EXPD(@);
  88.      @: {X == -1,
  89.          X == 2/3}
  90.  
  91.      ? EXPD((X-1)*(X-2)*(X-3)*(X-4));
  92.      @: 24 - 50*X + 35*X^2 - 10*X^3 + X^4
  93.  
  94.      ? SOLVE(@,X);
  95.      @: {X == 4,
  96.          X == 1,
  97.          X == 3,
  98.          X == 2}
  99.  
  100.      ? EXPD((X-1)*(X+1)*(X+3));
  101.      @: -3 - X + 3*X^2 + X^3
  102.  
  103.      ? SOLVE(@,X);
  104.      @: {X == -1+6/(3^(3/2)*#E^(#I*#PI/6))+2*#E^(#I*#PI/6)/
  105.      3^(1/2),
  106.          X == -1-1/(3^(1/2)*#E^(#I*#PI/6))-#E^(#I*#PI/6)/
  107.      3^(1/2)+#I/#E^(#I*#PI/6)-#E^(#I*#PI/6)*#I,
  108.          X == -1-1/(3^(1/2)*#E^(#I*#PI/6))-#E^(#I*#PI/6)/
  109.      3^(1/2)-#I/#E^(#I*#PI/6)+#E^(#I*#PI/6)*#I}
  110.  
  111.      ? TRGEXPD(@,-7);
  112.      @: {X == 1-#I/3^(1/2)+#I/3^(1/2),
  113.          X == -1,
  114.          X == -3}
  115.  
  116.      ? EXPD(@);
  117.      @: {X == 1,
  118.          X == -1,
  119.          X == -3}
  120.  
  121. Of course, this last example used file TRGNEG.ALG for the
  122. evaluation of the complex exponentials.
  123.  
  124. This file is not as useful as you might expect at first.  I
  125. must admit that the above examples are contrived so that they
  126. will look good.  To see an example where the formulas do not
  127. work well, try EXPD((X-1)*(X-2)*(X+4)); and then SOLVE(@,X);
  128. Can you get muMATH to simplify these roots to  1, 2, and -4 ?
  129. Can you even tell which root is 1 ?
  130.  
  131.  
  132. ============================================================
  133. TRGNEG.ALG
  134.  
  135. This is a replacement for the existing TRGNEG.ALG.  Exact
  136. evaluation of many more functions is now possible.  SIN and COS
  137. of rational multiples of #PI, where the denominator is a power
  138. of 2 possibly multiplied by 3 or 5 (or both) are included.
  139. These are cases that can be evaluated using only square roots.
  140. (I have not included all such angles that are theoretically
  141. possible, such as #PI/17 and #PI/65537.)  Examples:
  142.  
  143.      ? DENNUM: -6;
  144.      @: -6
  145.  
  146.      ? COS(2*#PI/5);
  147.      @: -1/4 + 5^(1/2)/4
  148.  
  149.      ? COS(#PI/16);
  150.      @: (2^(3/4)+(1+2^(1/2))^(1/2))^(1/2) / 2^(7/8)
  151.  
  152.      ? SIN(11*#PI/15);
  153.      @: (7-5^(1/2)+(30-5^(1/2)*6)^(1/2))^(1/2) / 4
  154.  
  155.  
  156. ============================================================
  157. ATRG.TRG
  158.  
  159. This file handles inverse trigonometric functions.  It depends
  160. on TRGNEG.ALG.
  161.  
  162. The functions in this file are:
  163.  
  164.      ASIN(X)     arc sine of X
  165.      ACOS(X)     arc cosine of X
  166.      ATAN(X)     arc tangent of X
  167.      ACOT(X)     arc cotangent of X
  168.      ASEC(X)     arc secant of X
  169.      ACSC(X)     arc cosecant of X
  170.  
  171. Firstly, if PBRCH is non-false, these functions are all written
  172. in terms of ASIN and ATAN.  Example:
  173.  
  174.      ? ACOS(U);
  175.      @: #PI/2 - ASIN(U)
  176.  
  177. Certain elementary reductions are carried out:
  178.  
  179.      ? ATAN(TAN(U));
  180.      @: U
  181.  
  182.      ? ACOS(SIN(X));
  183.      @: #PI/2 - X
  184.  
  185. Inverse trig functions are evaluated in a few cases.  (I
  186. have essentially just included a list of the cases in the
  187. program, probably not a very good algorithm.)
  188.  
  189.      ? ASIN(1/2);
  190.      @: #PI / 6
  191.  
  192.      ? ASEC(2^(1/2));
  193.      @: #PI / 4
  194.  
  195.      ? ATAN(MINF);
  196.      @: -#PI / 2
  197.  
  198. This is useful in connection with some of the other files:
  199.  
  200.      ? DEFINT(1/(1+X+X^2),X,-1/2,0);
  201.      @: #PI / 3^(3/2)
  202.  
  203.      ? DEFINT(1/(1+X^2),X,MINF,PINF);
  204.      @: #PI
  205.  
  206. This feature is helpful also with SERIES.DIF, described below.
  207.  
  208. When TRGEXPD is a positive multiple of 7, inverse trigonometric
  209. functions are converted to expressions involving logarithms:
  210.  
  211.      ? ATAN(U);
  212.      @: ATAN (U)
  213.  
  214.      ? TRGEXPD(@,7);
  215.      @: #I*LN((#I+U)/(#I-U)) / 2
  216.  
  217. The reverse transformation is described below in file LOG.ALG.
  218.  
  219.  
  220. ============================================================
  221. LOG.ALG
  222.  
  223. This file contains only one new feature.  I can't think of a
  224. situation in which to use it; I have included it only because
  225. it is the logical reverse of a feature of ATRG.TRG, above.
  226.  
  227. In file ATRG, inverse trig functions are replaced by logarithms
  228. when TRGEXPD is a positive multiple of 7.  In this file, the
  229. reverse can be done.  If TRGEXPD is a negative multiple of
  230. 7, then natural logarithms are converted to inverse trig
  231. functions.  Example:
  232.  
  233.      ? A:LOG(U);
  234.      @: LN(U)
  235.  
  236.      ? TRGEXPD: -7;
  237.      @: -7
  238.  
  239.      ? EVAL(A);
  240.      @: 2 * #I * ATAN((#I-#I*U)/(1+U))
  241.  
  242.  
  243. ============================================================
  244. INT.DIF and LIM.DIF
  245.  
  246. There are minor changes in these files to take into account
  247. the error function ERF.  Examples:
  248.  
  249.      ? ERF(0);
  250.      @: 0
  251.  
  252.      ? ERF(MINF);
  253.      @: -1
  254.  
  255. The following example is done with INT.DIF, INTMORE.INT,
  256. LIM.DIF, and LOG.ALG (for those with a lot of memory):
  257.  
  258.      ? DEFINT(#E^-X^2,X,MINF,PINF);
  259.      @: #PI ^ (1/2)
  260.  
  261.  
  262. ============================================================
  263. SERIES.DIF
  264.  
  265. This file is a replacement for the existing file SIGMA.ALG.
  266. Usage of SIGMA and PROD are as described in the manual.  The
  267. file has been completely rewritten.  Notice that SERIES
  268. requires DIF.ALG and is larger than SIGMA.  All of the series
  269. that SIGMA can do and several of the most common infinite
  270. series can be summed.
  271.  
  272. The program may ask questions in the manner of LIM in order to
  273. determine which method to use or to determine whether a series
  274. converges.  The files LOG.ALG, TRGNEG.ALG, and ATRG.TRG may be
  275. useful with this file.  Some of the examples below were done
  276. with the help of these additional files.
  277.  
  278.      ? SIGMA(N^2*3^N,N,1,K);
  279.      @: -3/2 + 3^(1+K)*K + 3^(1+K)*K^2/2 - 3^(2+K)*K/2 +
  280.      3^(1+K)/2 - 3^(3+K)/4 + 3^(3+K)/4
  281.  
  282.      ? SIGMA((-1)^N*X^(2*N+1)/(2*N+1)!,N,0,PINF);
  283.      @:
  284.      ???  - X^2  ???
  285.      ENTER SIGN (0 + -)? -
  286.       SIN(X)
  287.  
  288.      ? SIGMA(2^N/(4*N-1)!,N,3,PINF);
  289.      @: -421/1260 - SIN(2^(1/4))/2^(3/4) - 2^(1/4)/(4*
  290.      #E^2^(1/4)) + 2^(1/4)*#E^2^(1/4)/4
  291.  
  292.      ? SIGMA((-1)^N/N,N,1,PINF);
  293.      @: - LN(2)
  294.  
  295.      ? SIGMA(X^N/(2*N+3),N,1,PINF);
  296.      @:
  297.      ???  1 + X  ???
  298.      ENTER SIGN (0 + -)? +
  299.  
  300.      ???  1 - X  ???
  301.      ENTER SIGN (0 + -)? +
  302.  
  303.      ???  X  ???
  304.      ENTER SIGN (0 + -)? +
  305.       -1/3 - LN(1-X^(1/2))/(2*X^(3/2)) + LN(1+X^(1/2))/(2*
  306.      X^(3/2)) - 1/X
  307.  
  308.      ? SIGMA((-1)^N/(3*N+1),N,1,PINF);
  309.      @: -1 + #PI/3^(3/2) + LN(2)/3
  310.  
  311.      ? SIGMA(N^2/((2*N+1)*4^N),N,0,PINF);
  312.      @: -1/9 + LN(3/2)/4 - LN(1/2)/4
  313.  
  314.      ? LOGEXPD(@,30);
  315.      @: -1/9 + LN(3)/4
  316.  
  317. Without LOG.ALG:
  318.  
  319.      ? SIGMA(N*X^N/N!,N,0,PINF);
  320.      @: #E^X * X * LOG(#E,#E)
  321.  
  322. Try this one to see an impressive-looking answer:
  323.  
  324.      ? SIGMA((-1)^N/(5*N+2),N,0,PINF);
  325.  
  326.  
  327. ============================================================
  328.  
  329. In addition to these descriptions, let me list a few bugs (or
  330. misprints - the distinction is a bit fuzzy here) in muMATH
  331. (at least in version 2.12).
  332.  
  333. 1.  In file DIF.ALG, in the function beginning
  334.  
  335.           PROPERTY DIF, DEFINT,
  336.  
  337.     the line just before ENDFUN should end
  338.  
  339.                         EVSUB(EX1,EX2,EX3),
  340.  
  341.     For example,
  342.  
  343.          ? DIF( DEFINT(F(T),T,X,0), X );
  344.  
  345.     should yield
  346.  
  347.          @: -F(X)
  348.  
  349.     not
  350.  
  351.          @: -F(T)
  352.  
  353. 2.  In file LIM.DIF, in the function beginning
  354.  
  355.           PROPERTY LIM, !,
  356.  
  357.     (near the end of the file), the second line should
  358.     contain
  359.  
  360.           EX1:LIM1(EX1,#LIM),
  361.  
  362.     rather than
  363.  
  364.           EX1:LIM(EX1,#LIM),
  365.  
  366. 3.  Also in file LIM.DIF, the handling of LIM with only one
  367.     argument supplied is not as specified in the manual.
  368.     For example, try the following:
  369.  
  370.           ? LIM(R+S);
  371.           @: ?
  372.  
  373.           ? LIM((X-X^2)/(1-X));
  374.           @: 0
  375.  
  376.     If you get these (wrong) answers, here is a fix: In
  377.     FUNCTION LIM , move the four lines between BLOCK and
  378.     ENDBLOCK (inclusive) to the beginning (just before
  379.     `LOGBAS: #E,') and then just after these four lines
  380.     (still before `LOGBAS: #E,') add a new line:
  381.  
  382.           WHEN NOT INDET, LIM1(EX1,#LIM)  EXIT,
  383.  
  384.     Now you should get the correct answers:
  385.  
  386.           ? LIM(R+S);
  387.           @: R + S
  388.  
  389.           ? LIM((X-X^2)/(1-X));
  390.           @: (X-X^2) / (1-X)
  391.  
  392. 4.  This one is not really a bug, but it will speed up LIM
  393.     involving exponents when LOG.ALG is not loaded.  In
  394.     FUNCTION LIM , change
  395.  
  396.           LOGEXPD: 70,
  397.  
  398.     to
  399.  
  400.           LOGEXPD: 10,
  401.  
  402.     then in PROPERTY LIM, ^, at the beginning (just after the
  403.     comment % Fluid vars ... % ) add five new lines:
  404.  
  405.           BLOCK
  406.             WHEN FREE(EX3,INDET) OR FREE(EX4,INDET),
  407.               EX2:EX4, EX1:EX3  EXIT,
  408.             EX2:EX4*LOG(EX3,#E), EX1:#E,
  409.           ENDBLOCK,
  410.  
  411.     and finally change the next-to-last line (just before
  412.     ENDFUN) from
  413.  
  414.           EX1^EX2,
  415.  
  416.     to
  417.  
  418.           LIM1(EX3,#LIM)^LIM1(EX4,#LIM),
  419.  
  420.  
  421. 5.  In the manual, page 9-4, item 4. near the top of the
  422.     page, the second sentence should begin
  423.  
  424.           When TRGEXPD is a negative multiple of 7,
  425.  
  426.     The correct information is given on page 9-28.
  427.  
  428. =============================================================
  429.