;;; -*- Mode:LISP; Package:MACSYMA -*- ; ** (c) Copyright 1981 Massachusetts Institute of Technology ** (DEFSCRIPT $ASSIGNMENT "In MACSYMA variables are assigned values by use of a :, for example, if you want to set a equal to 3, you would type" "a:3;" "and MACSYMA would respond" (DISPLA '3) "Assign a numerical value to A" (INCHKP 'ASSIGNCHKP) "The values assigned to variables may be complex, " (MACSYMA '((MSETQ) $C ((MTIMES) ((%COS SIMP) $X) ((%SIN SIMP) $X)))) "The difference between expressions and functions is sometimes difficult to understand in MACSYMA. For example, you can type to MACSYMA" "f(x)=x^2" "or you could type" "f(x):=x^2" "MACSYMA will accept either form, but will treat them differently. The first, which looks familiar to mathematicians as a function, is to MACSYMA only an equation. If you ask MACSYMA to evaluate f(2), MACSYMA will type back F(2). The second, with the colon equals is the proper MACSYMA function definition for the function X squared." "Type in a simple function for f(x)." (FUNCHKP '(MDEFINE) '(($F) $X)) "Now ask MACSYMA to tell you the value of this function for some value of X:" (INCHKP 'VALUEP) "We defined C above as SIN(X) times COS(X). Now, let's define a function that uses C. Type in g(x):=C^2." (INCHK '((MDEFINE) (($G) $X) ((MEXPT) $C 2))) "Notice that MACSYMA has not inserted the value of C in this function definition." "To get MACSYMA to evaluate G(X) and use the value it knows for C, type" "ev(g(x));" (INCHK '(($EV)(($G) $X))) "Now let's remove the value we assigned to C. To do this type" "kill(c);" (INCHK '(($KILL) $C)) "Now ask MACSYMA to evaluate G(X) again." (INCHK '(($EV)(($G) $X))) "You assigned a value to A above, ask MACSYMA to evaluate the function F for the value of A. Type F(A)." (INCHK '(($F) $A)) "When you have assigned values to a lot of variables, and defined a number of functions, it is important to be able to tell what you have assigned. MACSYMA maintains lists of these things for you. Type VALUES; to see a list of the variables to which you have assigned values." (INCHK '$VALUES) "Typing FUNCTIONS; will list the functions which you have defined." (INCHK '$FUNCTIONS) "To print out the complete function definition of one of your functions use the command DISPFUN, which takes the name of the function to be printed out as an argument. Use DISPFUN to display the definition of your function F." (CMDCHKP '(($DISPFUN) $F)) "INFOLISTS is a list of the lists of information MACSYMA maintains. Type INFOLISTS; to see the names of all these lists." (INCHK '$INFOLISTS) "Typing EV(INFOLISTS); will give you a list of the things in each of the lists." (INCHK '(($EV) $INFOLISTS)) "Checking INFOLISTS periodically during a session can help you keep track of the information you have in your MACSYMA. It is also useful for determining what information you had stored in a file when you reload the file (see the FILING section of the Primer)." "What would you like to go over now?" (PRIMER-SELECT '($INTRO $SIMPLIFICATION $SCRATCHPAD $SYNTAX $EXIT)) ) (DEFSCRIPT $FILING "This script is not ready yet. Try it again in a few weeks.") (DEFSCRIPT $STRINGCOMMANDS "This script temporarily does not exist." )