%File: CLES2.ARI (c) 08/10/80 The Soft Warehouse % LINELENGTH (78)$ #ECHO: ECHO$ ECHO: TRUE$ % This file is the second of a sequence of interactive lessons on how to use the muMATH symbolic math system. This lesson presumes that the muMATH files through ARITH.MUS have been loaded. For positive integer N, N factorial is the product of the first N integers. The "postfix" factorial operator is "!", which returns the factorial of its operand. For example, 3! yields 6, which is 1*2*3. Use this operator to determine the product of the first 100 integers: % RDS: FALSE $ % The number base used for input and output is initially ten, but the RADIX function can be used to change it to any base from two through thirty-six. For example, to see what thirty looks like in base two: % THIRTY: 30 $ RADIX (2) ; THIRTY ; % As you can see, the radix function returns the previous base, which is, of course, displayed in the new number base. This inforation helps to get back to a previous base. In base two, eight is written as 1000, so to see what thirty looks like in base eight: % RADIX (1000) ; THIRTY ; % In base eight, sixteen is written as 20, so to see what thirty looks like in base sixteen: % RADIX (20) ; THIRTY ; % As you can see, the letters A, B, ... are used to represent the digits ten, eleven, ... for bases exceeding ten. Now can you guess why we limit the base to thirty six? In input expressions, integers beginning with a letter as the most significant digit must begin with a leading zero so as not to be interpreted as a name. For example, in base sixteen, ten is the letter- digit A, so to return to base ten: % RADIX (0A) ; % Why don't you now see what ninety-nine raised to the ninety-nine power looks like in base two and in base thirty-six, then return to base ten: % RDS: FALSE $ % As you may have discovered, it is easy to become confused and have a hard time returning to base ten. Two is represented as 2 in any base exceeding 1, so a foolproof way to get from any base to any other is to first get to base two, then express the desired new base in base two. For example: % RADIX (2) ; RADIX (1010) ; % Now we are guaranteeably in base ten, no matter how badly you got lost. Now consider irrational arithmetic: Did you know that (5 + 2*6^(1/2))^(1/2) - 2^(1/2) - (3/2)^(1/2) can be simplified to 0, provided we make certain reasonable choices of branches for the square roots? In general, simplification of arithmetic expressions containing fractional powers is quite difficult, but muMATH makes a valiant attempt. For example: % 4 ^ (1/2) ; 12 ^ (1/2) ; 1000 ^ (1/2) ; % Try simplifying the square roots of increasingly large integers to gain a feel for how the computation time increases with the complexity of the input and answer: % RDS: FALSE $ % An input of the form (m/n)^(p/q) is treated in the usual manner as (m^(1/q))^p / (n^(1/q))^p . For example: % (4/9) ^ (3/2) ; % For geometrically similar people, surface area increases as the 2/3 power of the mass. Veronica wears a 1 square-meter bikini, and she is 50,653 grams, whereas her look-alike mother is 132,651 grams. Use muMATH to determine the area of her mother's similar bikini: % RDS: FALSE $ % 4^(1/2) could simplify to either -2 or +2, but muMATH picks the positive real branch if one exists. Otherwise, muMATH picks the negative real branch if one exists, as illustrated by the example: % (-8) ^ (1/3) ; % What if no real branch exits? Then muMATH uses the unbound variable named #I to represent the IMAGINARY number (-1)^(1/2), and expresses the answer in terms of #I, using the branch having smallest positive argument. For example: % (-4) ^ (1/2) ; % Decent simplification of expressions containing imaginary numbers, as described in lesson CLES4.ALG, requires that file ALGEBRA.ARI be loaded. Meanwhile if you believe in imaginary numbers and you can't contain your curiosity, why don't you experiment with them to see what muMATH knows about them: % RDS: FALSE $ % As with manual computation, picking a branch of a multiply-branched function is hazardous, so answers thereby obtained should be verified by substitution into the original problem or by physical reasoning. For this reason, there is a CONTROL VARIABLE named PBRCH, initially TRUE, which suppresses Picking a BRanCH if FALSE. For example: % PBRCH: FALSE $ 4 ^ (1/2); % Users having a conservative temperament might prefer to do most of their computation with PBRCH FALSE. This brings us to the end of CLES2.ARI. Though arithmetic, some of the features illustrated in this lesson may be foreign to you, because sometimes they are taught during algebra rather than before. Thus, if you have any algebra background whatsoever, we urge you to proceed to lesson CLES3.ALG even if some of CLES2.ARI was intimidating. Naturally, as implied by its type, file CLES3.ALG requires a muMATH system containing files through ALGEBRA.ARI. If you decide not to proceed to algebra, but want to learn how to program using muSIMP, then proceed to lesson PLES1.ARI. % ECHO: #ECHO$ PBRCH: TRUE$ RDS () $