%File: CLES1.ARI (c) 08/10/80 The Soft Warehouse % LINELENGTH (78)$ #ECHO: ECHO$ ECHO: TRUE$ % If this lesson is being displayed too fast, it can be temporarily stopped by typing a CTRL-S (i.e. typing the letter "S" while depressing the CTRL key). Then type it again when you are ready to resume. It is advisable to read sections 4 through 6 and 8 of the muMATH Reference Manual before beginning these lessons. This lesson can be aborted at any time by typing the ESCape key or the ALTmode key on your console followed by a CTRL-C. In muMATH a "comment" is a percent sign followed by any number of other characters terminated by a matching percent sign. Thus, this explanation is a comment which has not yet been terminated. Comments do not cause computation; they are merely used to explain programs and examples to human readers. Here is an example of an actual computation% 1/2 + 1/6 ; % Note how muMATH uses exact rational arithmetic, reducing fractions to lowest terms. In muMATH, arithmetic expressions can be formed in the usual manner, using parentheses together with the operators "+", "-", "*", "/", and "^" respectively for addition, subtraction or negation, multiplication, division, and raising to a power. For example: % (3*4 - 5) ^ 2 ; % On some terminals, "^" looks like an upward-pointing arrow; on others it looks like a shallow upside-down letter V; and some terminals may employ an utterly different looking character which you may have to determine by experimentation. The reason for using ^ and * is that standard terminals do not provide superscripts or centered dots or special multiplication crosses distinct from the letter X. To prevent certain ambiguities, multiplication cannot be implied by mere juxtaposition. One of the most frequent mistakes of beginners is to omit asterisks. Later, in order to give you an opportunity to try some examples, we will "assign" the value FALSE to the variable named RDS. When you are ready to resume the lesson, type the "assignment" RDS: TRUE ; including the semicolon and carriage return. This revises the value of the variable named RDS to the value TRUE. We will explain assignment in more detail later. Don't forget that you can use local editing to correct mistypings on the current line. For example, on many operating systems, the key marked RUBout or DELete cancels the last character typed on the line, and typing a CTRL-U cancels the current line. There is no way to modify a line after striking the RETurn key, but an expression can always be flushed by typing a final line containing a "grammatical" or "syntax" error such as "(;". Now we are going to turn control over to you by setting RDS to FALSE. Try some examples of your own similar to the above. Also we suggest that you make a few intentional errors in order to become familiar with how they are treated. For example, try 5 7; 5+ /7; 5/0; and 0/0; Have fun!: % RDS: FALSE ; % The value resulting from the last input expression is automatically saved as the value of a variable named "@", which can be used in the next expression. For example: % 3 ;@ ^ @ ;@ ^ @; % As this example illustrates, muMATH can treat very large numbers exactly and quickly. In fact, muMATH can accomodate numbers up to about 611 digits. To partially appreciate how large this is, compute the distance in feet or in meters to the star Alpha Centauri, which is 4 light years away, then use "@" to compute the distance in inches or in centimeters without starting all over. (In case you forgot, the speed of light is 186,000 miles/second or 300,000,000 meters/second.) % RDS: FALSE ; % Our answers are about 123,883,499,520,000,000 feet or 1,486,601,994,240,000,000 inches or 37,843,200,000,000,000 meters or 3,784,320,000,000,000,000 centimeters. Another dramatic comparison with 10^611 is that there are thought to be about 10^72 electrons in the entire universe. (Whoever counted them must be exhausted!) Often one performs an intermediate computation or a trivial assignment for which there is no need to display the result. When this is the case, the display of the result can be suppressed by using a dollar sign rather than a semicolon as a terminator. For example, type RDS: TRUE $ and note the difference from when you previously typed RDS:TRUE ; % RDS: FALSE $ % It is often convenient to save values longer than "@" saves them, for use beyond the next input expression. The colon ASSIGNMENT operator provides a means of doing so. The name on the left side of the assignment operator is BOUND or SET to the value of the expression on its right. This value is saved as the value of the name until the name is bound subsequently to some other value. The name can be used as a variable in subsequent expressions, as we have used "@", in which case the name contributes its value to the expression. For example: % RATE: 55 $ TIME: 2 $ DISTANCE: RATE * TIME ; % Alphabetic characters include the letters A through Z, both upper and lower case, and the character "#". Note that the upper and lower case version of a letter are entirely distinct. Names can be any sequence of alphabetic characters or digits, provided the first character is alphabetic. Thus X, #9, and ABC3 are valid names. Make an assignment of 3600 to a variable named SECPERHOUR, then use this variable to help compute the number of seconds in 1 day and 1 week: % RDS: FALSE $ % Congratulations on completing CLES1.ARI. To execute the next lesson, merely enter the muMATH command RDS (CLES2, ARI, drive); where drive is the name of the drive on which that lesson is mounted. Alternatively, it may be advisable to repeat this lesson, perhaps another day, if this lesson was not perfectly clear. The use of any computer program tends to become much clearer the second time. In order to experience the decisive learning reinforcement afforded by meaningful personal examples that are not arbitrarily contrived, we urge you to bring to subsequent lessons appropriate examples from textbooks, tables, articles, or elsewhere. Also, you are encouraged to experiment further with the techniques learned in this lesson: % ECHO: #ECHO $ RDS () $