Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Cliff Yapp <starseeker@us...>  20040925 21:40:13

Update of /cvsroot/maxima/maximabook/basics In directory sc8prcvs1.sourceforge.net:/tmp/cvsserv2367/basics Added Files: basics.tex Log Message: Import main tex files  NEW FILE: basics.tex  %*EMaxima* Here we will attempt to address universal concepts which you will need to know when using Maxima for a wide variety of tasks. \section{The Very Beginning} All computer algebra systems have syntactical rules, i.e. a structured language by which the user communicates his/her commands to the system. Without being able to communicate in this language, it is impossible to accomplish anything in such as system. So we will attempt to describe herein the basics. \subsection{Our first Maxima Session} We will start by demonstrating the ultimate basics: \( + \), \(  \), \( * \), and /. These symbols are virtually universal in any mathematical system, and mean exactly what you think they mean. We will demonstrate this, and at the same time introduce you to your first session in Maxima. In the interface of your choice, try the following: \vspace{3ex} \texttt{\label{Example1}GCL (GNU Common Lisp)~ Version(2.3.8) Wed Sep~ 5 08:00:22 CDT 2001} \texttt{Licensed under GNU Library General Public License} \texttt{Contains Enhancements by W. Schelter} \texttt{Maxima 5.5 Wed Sep 5 07:59:43 CDT 2001 (with enhancements by W. Schelter).} \texttt{Licensed under the GNU Public License (see file COPYING)} \beginmaximasession 2+2; 31; 3*4; 9/3; 9/4; quit(); \maximatexsession \i1. 2+2; \\ \o1. 4 \\ \i2. 31; \\ \o2. 2 \\ \i3. 3*4; \\ \o3. 12 \\ \i4. 9/3; \\ \o4. 3 \\ \i5. 9/4; \\ \o5. \frac{9}{4} \\ \i6. quit(); \\ \endmaximasession \vspace{3ex} Above is our first example of a Maxima session. We notice already several characteristics of a Maxima session: The startup message, which gives the version of Maxima being used, the date of compilation, which is the day your executable was created, the labels in front of each line, the semicolon at the end of each line, and the way we exit the session. The startup message is not important to the session, but you should take note of what version of Maxima you are using, especially if there is a known problem in an earlier version which might impact what you are trying to do. \subsubsection{Exiting\index{Exiting} \index{Quitting}\index{Debugging!Exiting}a Maxima Session} You want to be able to get out of what you get into. So the first command we discuss will be the command that gets you out of Maxima, and while we are at it we will discuss how to get out of debugging mode. Debugging mode is quite useful for some things, and the reader is encouraged to look to later chapters for an indepth look at the debugging mode, but for now we will stick to basics. As you see above, \texttt{quit();} is the command which will exit Maxima. This is a bit confusing for new users, but you must type that full command. Simply typing \texttt{quit} or \texttt{exit} will not work, nor will pressing \texttt{CTRLC}  if you try the latter you will be dumped into the debugging mode. If that happens, simply type \texttt{:q} if you are running GNU Common Lisp, or \texttt{:a} if running CLISP. (If in doubt use \texttt{:q}  most binary packages use GCL at this time.) Here's an example of what not to do, and how to get out of it if you do: \vspace{3ex} \texttt{\label{Quitting Maxima (Example 2)}(\%i1) quit;} \texttt{~} \texttt{(\%o1)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ QUIT} \texttt{(\%i2) exit;} \texttt{~} \texttt{(\%o2)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ EXIT} \texttt{(\%i3) } \texttt{Correctable error: Console interrupt.} \texttt{Signalled by MACSYMATOPLEVEL.} \texttt{If continued: Type :r to resume execution, or :q to quit to top level.} \texttt{Broken at SYSTEM:TERMINALINTERRUPT.~ Type :H for Help.} \texttt{MAXIMA>\,{}>} \texttt{Correctable error: Console interrupt.} \texttt{Signalled by SYSTEM:UNIVERSALERRORHANDLER.} \texttt{If continued: Type :r to resume execution, or :q to quit to top level.} \texttt{Broken at SYSTEM:TERMINALINTERRUPT.} \texttt{MAXIMA>\,{}>\,{}>:q} \texttt{~} \texttt{(\%i3) quit()}; \vspace{3ex} The first two lines show what happens if you forget the \texttt{()} or type \texttt{exit}. Nothing major, but you won't exit Maxima. \texttt{CTRLC} causes a few more problems  if you actually read the message, you will see it tells you how to handle it. In the above example, \texttt{CTRLC} was hit twice  that is not a proper way to exit Maxima either. Just remember to use \texttt{:q} to exit debugging and \texttt{quit();} to exit Maxima, and you should always be able to escape trouble. If you find youself trying to read a long output going by quickly on a terminal, press \texttt{CTRLS} to temporarily halt the output, and \texttt{CTRLQ} to resume. \subsubsection{The End of Entry Character} All expressions entered into Maxima must end with either the ; character or the \$ character. The ; character is the standard character to use for this purpose. \index{Hiding output}The \$ symbol, while performing the same job of ending the line, suppresses the output of that line. This example illustrates these properties: \vspace{3ex} \label{End of Entry Characters (Example 3)} \beginmaximasession x^5+3*x^4+2*x^3+5*x^2+4*x+7; x^5+3*x^4+2*x^3+5*x^2+4*x+7$ %o2; x^5+3*x^4+2*x^3 +5*x^2+4*x+7; x^5+3*x^4+2*x^3 +5*x^2+4*x+7; \maximatexsession \i1. x^5+3*x^4+2*x^3+5*x^2+4*x+7; \\ \o1. x^{5}+3\*x^{4}+2\*x^{3}+5\*x^{2}+4\*x+7 \\ \i2. x^5+3*x^4+2*x^3+5*x^2+4*x+7$ \\ \i3. %o2; \\ \o3. x^{5}+3\*x^{4}+2\*x^{3}+5\*x^{2}+4\*x+7 \\ \i4. x^5+3*x^4+2*x^3 +5*x^2+4*x+7; \\ \o4. x^{5}+3\*x^{4}+2\*x^{3}+5\*x^{2}+4\*x+7 \\ \i5. x^5+3*x^4+2*x^3 +5*x^2+4*x+7; \\ \o5. x^{5}+3\*x^{4}+2\*x^{3}+5\*x^{2}+4\*x+7 \\ \endmaximasession \vspace{3ex} In (\%i1), we input the expression using the ; character to end the expression, and on the return line we see that \%o1 now contains that expression. In (\%i2), we input an identical expression, except that we use the \$ to end the line. (\%o2) is assigned the contents of (\%i2), but does not visually display those contents. Just to verify that (\%o2) does in fact contain what we think it contains we ask Maxima to display it's contents on (\%i3) and we see that the are in fact present. This is extremely useful if you are working on a problem which has many steps, and some of those steps would produce long outputs you don't need to actually see. In (\%i4), we input part of the expression, press return, finish the expression, and then use the ; character. Notice that the input did not end until we used that character and pressed return  return by itself does nothing. You see (\%o4) contains the same expression as (\%o1) shown above. To Maxima, the inputs are the same. This can be useful if you are going to input a long expression and wish to keep it straight visually, to avoid errors. You can also input spaces without adversely affecting the formula, as shown in (\%i5). \subsubsection{The (\%i{*}) and (\%o{*}) Labels} These labels are more than just line markers  they are actually the names in memory of the contents of the lines. This is quite useful for a number of tasks. Let's say you wish to apply a routine, say a \texttt{solve} routine, to an expression for several different values. Rather than retyping the entire expression, we can use the fact that the line numbers act as markers to shorten our task considerably, as in this example: \vspace{3ex} \label{Line Labels (Example 4)} \beginmaximasession 3*x^2+7*x+5; solve(%o1=3,x); solve(%o1=7,x); solve(%o1=a,x); \maximatexsession \i1. 3*x^2+7*x+5; \\ \o1. 3\*x^{2}+7\*x+5 \\ \i2. solve(%o1=3,x); \\ \o2. \left[ x=\frac{1}{3},\linebreak[0]x=2 \right] \\ \i3. solve(%o1=7,x); \\ \o3. \left[ x=\frac{\sqrt{73}+7}{6},\linebreak[0]x=\frac{\sqrt{73}7}{6} \right] \\ \i4. solve(%o1=a,x); \\ \o4. \left[ x=\frac{\sqrt{12\*a11}+7}{6},\linebreak[0]x=\frac{\sqrt{12\*a11}7}{6} \right] \\ \endmaximasession \vspace{3ex} In this example, we desire to solve the expression \( 3x^{2}+7x+5 \) for \( x \) when \( 3x^{2}+7x+5=3 \), \( 3x^{2}+7x+5=7 \), and \( 3x^{2}+7x+5=a \). (\( a \) in this case is an arbitrary constant.) Rather than retype the equation many times, we merely enter it once, and then use that label to set up the similar problems more easily. \subsubsection{The (\%t{*}) Labels} In some cases, particularly when a command needs to assign generated values to variable names, the \%t labels will be used. These may be treated like any other maxima variable. Here is an example of \%t label use: \beginmaximasession (x+y)^2/(x+z)^3; pickapart(%,1); \maximatexsession \i1. (x+y)^2/(x+z)^3; \\ \o1. \frac{\left(y+x\right)^{2}}{\left(z+x\right)^{3}} \\ \i2. pickapart(%,1); \\ \t2. \left(y+x\right)^{2} \\ \t3. \left(z+x\right)^{3} \\ \o3. \frac{\mathrm{\%t2}}{\mathrm{\%t3}} \\ \endmaximasession In this case, the \texttt{pickapart} command assigned parts of the expression to E lines. \subsubsection{Custom Labels} You do not need to settle for this method of labeling  you can define your own expressions if you so choose, by using the : assign operator. Let us say, for example, that we wish to solve the problem above, but would rather call our equation FirstEquation than D1. We will show that process here, with one deliberate error for illustration of a property: \vspace{3ex} \label{Labeling an Equation (Example 5)} \beginmaximasession FirstEquation:3*x^2+7*x+5; solve(FirstEquation=3,x); solve(FirstEquation=7,x); solve(FirstEquation=a,x); solve(firstequation=a,x); \maximatexsession \i3. FirstEquation:3*x^2+7*x+5; \\ \o3. 3\*x^{2}+7\*x+5 \\ \i4. solve(FirstEquation=3,x); \\ \o4. \left[ x=\frac{1}{3},\linebreak[0]x=2 \right] \\ \i5. solve(FirstEquation=7,x); \\ \o5. \left[ x=\frac{\sqrt{73}+7}{6},\linebreak[0]x=\frac{\sqrt{73}7}{6} \right] \\ \i6. solve(FirstEquation=a,x); \\ \o6. \left[ x=\frac{\sqrt{12\*a11}+7}{6},\linebreak[0]x=\frac{\sqrt{12\*a11}7}{6} \right] \\ \i7. solve(firstequation=a,x); \\ \o7. \left[ \right] \\ \endmaximasession \vspace{3ex} You see that this process works exactly the same as before. On line (\%i5), you see we entered the name of FirstEquation as lower case, and the calculation failed. These names are case sensitive. This is true of all variables. Later on you will see cases in Maxima such as sin, where SIN and sin are the same, but it is not safe to assume this is always true and when in doubt, watch your cases. In general we suggest you use lower case for your maxima commands and programs  it will make them easier to read and debug. \subsection{To Evaluate or Not to Evaluate} Operators in Maxima, such as diff for derivative, are a common feature in many Maxima expressions. The problem is, while you need to include an operator at a given point in your process, you may not want to deal with the output from it at that point in the problem. Therefore, Maxima provides the ' toggle for operators. See the example below for an example of how this works. \vspace{3ex} \label{Evaluation Toggle (Example 6)} \beginmaximasession diff(1/sqrt(1+x^3),x); 'diff(1/sqrt(1+x^3),x); \maximatexsession \i8. diff(1/sqrt(1+x^3),x); \\ \o8. \frac{3\*x^{2}}{2\*\iexpt{\left(x^{3}+1\right)}{\frac{3}{2}}} \\ \i9. 'diff(1/sqrt(1+x^3),x); \\ \o9. \frac{d}{d\*x}\*\frac{1}{\sqrt{x^{3}+1}} \\ \endmaximasession \vspace{3ex} \subsection{The Concept of Environment  The \texttt{ev} Command} All mathematical operations in Maxima take place in an environment, which is to say the system is assuming it should do some things and not do other things. There will be many times you will want to change this behavior, without doing so on a global scale. Maxima provides a way to define a local environment on a per command basis, using the \texttt{ev} command. \texttt{ev} is one of the most powerful commands in Maxima, and the user will benefit greatly if they master this command early on while using Maxima. \subsubsection{From the top} We will begin with a very simple example: \vspace{3ex} \label{Basic Use of ev Command (Example 7)} \beginmaximasession ev(solve(a*x^2+b*x+c=d,x),a=3,b=4,c=5,d=6); a; \maximatexsession \i1. ev(solve(a*x^2+b*x+c=d,x),a=3,b=4,c=5,d=6); \\ \o1. \left[ x=\frac{\sqrt{7}+2}{3},\linebreak[0]x=\frac{\sqrt{7}2}{3} \right] \\ \i2. a; \\ \o2. a \\ \endmaximasession \vspace{3ex} The first line uses the ev command to solve for \( x \) without setting variables in the global environment. To make sure that our variables remain undefined, we check that \( a \) is still undefined in line (\%i2), and it is. Now lets examine some of the more interesting features of ev. The general syntax of the ev command is ev(exp, arg1, ..., argn). exp is an expression, like the one in the example above. You can also use a \%o{*} entry name or your own name for an expression. arg{*} has many possibilities, and we will try to step through them here. \subsubsection{EXPAND(m,n)} Expand is an argument which allows you to limit how Maxima expands an expression  i.e., how high a power you want it to expand. m is the maximum positive power to expand, and n is the largest negative power to expand. Here is an example: \vspace{3ex} \label{ev's Expand Option (Example 8)} \beginmaximasession ev((x+y)^5+(x+y)^4+(x+y)^3+(x+y)^2+(x+y)+(x+y)^1+(x+y)^2+(x+y)^3+(x+y)^4+(x+y)^5,EXPAND(3,3)); \maximatexsession \i3. ev((x+y)^5+(x+y)^4+(x+y)^3+(x+y)^2+(x+y)+(x+y)^1+(x+y)^2+(x+y)^3+(x+y)^4+(x+y)^5,EXPAND(3,3)); \\ \o3. \frac{1}{y^{3}+3\*x\*y^{2}+3\*x^{2}\*y+x^{3}}+\frac{1}{y^{2}+2\*x\*y+x^{2}}+\left(y+x\right)^{5}+\left(y+x\right)^{4}+\frac{1}{y+x}+\frac{1}{\left(y+x\right)^{4}}+\frac{1}{\left(y+x\right)^{5}}+y^{3}+3\*x\*y^{2}+y^{2}+3\*x^{2}\*y+2\*x\*y+y+x^{3}+x^{2}+x \\ \endmaximasession \vspace{3ex} This may be a little hard to read at first, but if you look closely you will see that every power of \( 3\leq p\leq 3 \) has been expanded, otherwise the subexpression has remained in it's original form. This is extremely useful if you want to avoid filling up your screen with large expansions that no one can read or use. \subsubsection{Specifying Local Values for Variables, Functions, etc.} One of the best things about the ev command is that for one evaluation you may specify in an arg what values are to be used for the evaluation in place of variables, how to define functions, which functions to evaluate, etc. We will work through a series of examples here, probably this will be the best way to illustrate the various possibilities of this aspect of ev. \vspace{3ex} \beginmaximasession eqn1:'diff(x/(x+y)+y/(y+z)+z/(z+x),x); ev(eqn1,diff); ev(eqn1,y=x+z); ev(eqn1,y=x+z,diff); \maximatexsession \i4. eqn1:'diff(x/(x+y)+y/(y+z)+z/(z+x),x); \\ \o4. \frac{d}{d\*x}\*\left(\frac{y}{z+y}+\frac{z}{z+x}+\frac{x}{y+x}\right) \\ \i5. ev(eqn1,diff); \\ \o5. \frac{z}{\left(z+x\right)^{2}}+\frac{1}{y+x}\frac{x}{\left(y+x\right)^{2}} \\ \i6. ev(eqn1,y=x+z); \\ \o6. \frac{d}{d\*x}\*\left(\frac{z+x}{2\*z+x}+\frac{x}{z+2\*x}+\frac{z}{z+x}\right) \\ \i7. ev(eqn1,y=x+z,diff); \\ \o7. \frac{1}{2\*z+x}\frac{z+x}{\left(2\*z+x\right)^{2}}+\frac{1}{z+2\*x}\frac{2\*x}{\left(z+2\*x\right)^{2}}\frac{z}{\left(z+x\right)^{2}} \\ \endmaximasession \vspace{3ex} In this example, we define eqn1 to be the derivative of a function, but use the ' character in front of the diff operator to notify Maxima that we don't want it to evaluate that derivative at this time. (More on that in the ?? section.) In the next line, we use the ev with the diff argument, which instructs ev to take all derivatives in this expression. Now, let's say we want to define \( y \) as a function of \( z \) and \( x \), but again avoid evaluating the derivative. We supply our definition of \( y \) as an argument to ev, and in (\%o3) we see that the substitution has been made. Now, let's evaluate the derivative after the substitution has been made. We work as before, except this time we supply both the new definition of \( y \) and the diff argument, telling ev to make the substitution and then take the derivative. In this particular case, the order of the arguments does not matter. The case where it will matter is if you are making multiple substitutions  then they are handled in sequence from left to right. \vspace{3ex} (need example here, one where the difference is noticeable). \vspace{3ex} We can also locally define functions: \vspace{3ex} \beginmaximasession eqn4:f(x,y)*'diff(g(x,y),x); ev(eqn4,f(x,y)=x+y,g(x,y)=x^2+y^2); ev(eqn4,f(x,y)=x+y,g(x,y)=x^2+y^2,DIFF); \maximatexsession \i8. eqn4:f(x,y)*'diff(g(x,y),x); \\ \o8. f\left(x,\linebreak[0]y\right)\*\left(\frac{d}{d\*x}\*g\left(x,\linebreak[0]y\right)\right) \\ \i9. ev(eqn4,f(x,y)=x+y,g(x,y)=x^2+y^2); \\ \o9. \left(y+x\right)\*\left(\frac{d}{d\*x}\*\left(y^{2}+x^{2}\right)\right) \\ \i10. ev(eqn4,f(x,y)=x+y,g(x,y)=x^2+y^2,DIFF); \\ \o10. 2\*x\*\left(y+x\right) \\ \endmaximasession \vspace{3ex} (At the moment, ev seems to take only the first argument in the following example from solve: the manual seems to indicate it should be taking both as a list??) \vspace{3ex} \beginmaximasession eqn1:f(x,y)*'diff(g(x,y),x); eqn2:3*y^2+5*y+7; ev(eqn1,g(x,y)=x^2+y^2,f(x,y)=5*x+y^3,solve(eqn2=5,y)); ev(eqn1,g(x,y)=x^2+y^2,f(x,y)=5*x+y^3,solve(eqn2=1,y),diff); ev(eqn1,g(x,y)=x^2+y^2,f(x,y)=5*x+y^3,solve(eqn2=1,y),diff,FLOAT); \maximatexsession \i11. eqn1:f(x,y)*'diff(g(x,y),x); \\ \o11. f\left(x,\linebreak[0]y\right)\*\left(\frac{d}{d\*x}\*g\left(x,\linebreak[0]y\right)\right) \\ \i12. eqn2:3*y^2+5*y+7; \\ \o12. 3\*y^{2}+5\*y+7 \\ \i13. ev(eqn1,g(x,y)=x^2+y^2,f(x,y)=5*x+y^3,solve(eqn2=5,y)); \\ \o13. \left(5\*x\frac{8}{27}\right)\*\left(\frac{d}{d\*x}\*\left(x^{2}+\frac{4}{9}\right)\right) \\ \i14. ev(eqn1,g(x,y)=x^2+y^2,f(x,y)=5*x+y^3,solve(eqn2=1,y),diff); \\ \o14. 2\*x\*\left(5\*x\frac{\left(\sqrt{47}\*i+5\right)^{3}}{216}\right) \\ \i15. ev(eqn1,g(x,y)=x^2+y^2,f(x,y)=5*x+y^3,solve(eqn2=1,y),diff,FLOAT); \\ \o15. 2\*x\*\left(5\*x0.004629629629629629\*\left(\sqrt{47}\*i+5\right)^{3}\right) \\ \endmaximasession \vspace{3ex} \subsubsection{Other arguments for ev} INFEVAL  This option leads to an "infinite evaluation" mode, where ev repeatedly evaluates an expression until it stops changing. To prevent a variable, say X, from being evaluated a way in this mode, simply include X='X as an argument to ev. There are dangers with this command  it is quite possible to generate infinite evaluation loops. For example, ev(X,X=X+1,INFEVAL); will generate such a loop. Here is an example: (need example where this is useful.) \subsubsection{How ev works} The flow of the ev command works like this: \begin{enumerate} \item The environment is set up by scanning the arguments. During this step, a list is made of nonsubscripted variables appearing on the left side of equations in the arguments or in the value of some arguments if the value is an equation. Both subscripted variables which do not have associated array functions and nonsubscripted variables in the expression exp are replaced by their global values, except for those appearing in the generated list. \item If any substitutions are indicated, they are carried out. \item The resulting expression is then reevaluated, unless one of the arguments was NOEVAL, and simplified according to the arguments. Note that any function calls in exp will be carried out AFTER the variables in it are evaluated. \item If one of the arguments was EVAL, the previous two steps are repeated. \end{enumerate} \subsection{Clearing values from the system  the \texttt{kill} command} Many times you will define something in Maxima, only to want to remove that definition later in the computation. The way you do this in Maxima is quite simple  using the \texttt{kill} command. Here is an example: \beginmaximasession A:7$ A; kill(A); A; \maximatexsession \i16. A:7$ \\ \i17. A; \\ \o17. 7 \\ \i18. kill(A); \\ \o18. \mathrm{DONE} \\ \i19. A; \\ \o19. A \\ \endmaximasession \texttt{kill} is used in many situations, and has many uses. You will see it appear throughout this manual, in different contexts. There are general arguements you can use, such as \texttt{kill(all)}, which will essentially start you out in a new, clean environment. (Add any relevant general kill options here  save kill(rules) for rules section, etc.) \section{Assignment Operators} In mathematics, we quite often want to declare functions, assign values to numbers, and do many similarly useful things. Maxima has a variety of operators for this purpose. \begin{enumerate} \item [\bf{:}] The basic assignment operator. We have already seen this operator in action; it is one of the most common in maxima. \end{enumerate} \vspace{3ex} \beginmaximasession A:7; A; \maximatexsession \i20. A:7; \\ \o20. 7 \\ \i21. A; \\ \o21. 7 \\ \endmaximasession \vspace{3ex} \begin{enumerate} \item [\bf{:=}] This is the operator you would use to define functions. This is a common thing to do in computer algebra, so we will illustrate both how to and how not to do this. \end{enumerate} \vspace{2ex} The right way: \beginmaximasession y(x):= x^2; y(2); \maximatexsession \i22. y(x):= x^2; \\ \o22. y\left(x\right)\mathbin{:=}x^{2} \\ \i23. y(2); \\ \o23. 4 \\ \endmaximasession \vspace{2ex} Several possible wrong ways: \beginmaximasession y:=x^2; y=x^2; y(2); y(x)=x^2; y(2); y[x]=x^2; y[2]; \maximatexsession \i1. y:=x^2; \\ \p Improper function definition: y  an error. Quitting. To debug this try DEBUGMODE(TRUE); \\ \i2. y=x^2; \\ \o2. y=x^{2} \\ \i3. y(2); \\ \o3. y\left(2\right) \\ \i4. y(x)=x^2; \\ \o4. y\left(x\right)=x^{2} \\ \i5. y(2); \\ \o5. y\left(2\right) \\ \i6. y[x]=x^2; \\ \o6. y_{x}=x^{2} \\ \i7. y[2]; \\ \o7. y_{2} \\ \endmaximasession \vspace{3ex} \begin{enumerate} \item [~] Look over the above example  it pays to know what doesn't work. If you recognize the error or incorrect result you get, it will make for faster debugging. \end{enumerate} \begin{enumerate} \item [\bf{::}] This operator is related to the : operator, but does not function in quite the same way. This is more what a programmer would refer to as a pointer. The best way to explain is to give you an example of how it behaves: \end{enumerate} \vspace{3ex} \beginmaximasession A:3$ B:5; C:'A; C::B; C; A; \maximatexsession \i8. A:3$ \\ \i9. B:5; \\ \o9. 5 \\ \i10. C:'A; \\ \o10. A \\ \i11. C::B; \\ \o11. 5 \\ \i12. C; \\ \o12. A \\ \i13. A; \\ \o13. 5 \\ \endmaximasession \vspace{3ex} You see C points to A, and A is thus assigned the value of B. \begin{enumerate} \item [\bf{!}] This is the factorial operator. \end{enumerate} \vspace{3ex} \beginmaximasession 8!; \maximatexsession \i14. 8!; \\ \o14. 40320 \\ \endmaximasession \vspace{3ex} \begin{enumerate} \item [\bf{!!}] This is the double factorial operator. This is defined in Maxima as the product of all the consecutive odd (or even) integers from 1 (or 2) to the odd (or even) arguement. \end{enumerate} \vspace{3ex} \beginmaximasession 8!!; 2*4*6*8; \maximatexsession \i15. 8!!; \\ \o15. 384 \\ \i16. 2*4*6*8; \\ \o16. 384 \\ \endmaximasession \vspace{3ex} \section{Constants and Data Types} \subsection{Predefined Constants in Maxima} Maxima already has some knowledge of basic mathematical constants built in. \vspace{3ex} \begin{enumerate} \item [\bf{\%pi}] Standard definition of Pi. \end{enumerate} \begin{enumerate} \item [\bf{\%e}] Base of Natural Logarithms \end{enumerate} \begin{enumerate} \item [\bf{\%i}] Square root of 1. \end{enumerate} \begin{enumerate} \item [\bf{inf}] Real positive infinity \end{enumerate} \begin{enumerate} \item [\bf{infinity}] Complex infinity  an infinite magnitude of arbitrary phase angle. \end{enumerate} \begin{enumerate} \item [\bf{minf}] Real negative infinity. \end{enumerate} \begin{enumerate} \item [\bf{\%gamma}] The EulerMascheroni constant. \end{enumerate} \vspace{3ex} \subsection{True and False} Maxima defines the basic Boolean contants in Logic  \begin{enumerate} \item [\bf{true}] True  defined in lisp as T \end{enumerate} \begin{enumerate} \item [\bf{false}] False  defined in lisp as NIL \end{enumerate} These basic types will be the return types of many operations in Maxima. \subsection{Data Types in Maxima} There are various types of data which can exist in Maxima, and some functions to test if an arguement is a particular type. \begin{enumerate} \item [\bf{atom}] A number or a name. It's test function is \texttt{atom(exp)}, returning true if the \texttt{exp} is a number or name, else returning false. \end{enumerate} This is the most basic data type in Maxima, but even so it can sometimes be a bit tricky to handle. One must consider evaluations, and their impact. Here is an example of some of the things to watch out for when using atom: \beginmaximasession A : 34*x+y*60; atom(A); atom('A); B : 'A; C : A; atom(B); atom(C); B : ev(B,atom); atom(B); \maximatexsession \i17. A : 34*x+y*60; \\ \o17. 60\*y+34\*x \\ \i18. atom(A); \\ \o18. \mathbf{false} \\ \i19. atom('A); \\ \o19. \mathbf{true} \\ \i20. B : 'A; \\ \o20. A \\ \i21. C : A; \\ \o21. 60\*y+34\*x \\ \i22. atom(B); \\ \o22. \mathbf{true} \\ \i23. atom(C); \\ \o23. \mathbf{false} \\ \i24. B : ev(B,atom); \\ \o24. 60\*y+34\*x \\ \i25. atom(B); \\ \o25. \mathbf{false} \\ \endmaximasession \vspace{3ex} 
Sign up for the SourceForge newsletter:
No, thanks