Minor fixes to two tensor demos, fix dumb gnuplot
[maxima.git] / doc / intromax / intromax.tex
blobda90f77b3303930ea01b1fb737cee9eeade52b73
1 \documentclass[a4paper,12pt]{article}
2 \usepackage[utf8]{inputenc}
3 \usepackage{fullpage}
5 \title{Introduction to Maxima}
6 \author{Richard H. Rand\\
7 Dept. of Theoretical and Applied Mechanics, Cornell University
8 \thanks{Adapted from ``Perturbation Methods, Bifurcation Theory and Computer Algebra''
9 by Rand and Armbruster, Springer, 1987.
10 Adapted to \LaTeX\ and HTML by Nelson L. Dias (nldias@simepar.br),
11 SIMEPAR Technological Institute and Federal University of ParanĂ¡, Brazil.
12 Updated by Robert Dodier, August 2005.}}
13 \date{\empty}
15 \begin{document}
16 \maketitle
18 \noindent
19 Copyright (c) 1988-2010 Richard H. Rand.
21 \noindent
22 This document is free; you can redistribute it and/or modify it under
23 the terms of the GNU General Public License as published by the Free
24 Software Foundation. See the GNU General Public License for more
25 details at http://www.gnu.org/copyleft/gpl.html
27 \tableofcontents
29 \newpage
30 \section{Introduction \label{sec:introduction}}
32 To invoke Maxima in a console, type
33 \begin{verbatim}
34 maxima <enter>
35 \end{verbatim}
38 The computer will display a greeting of the sort:
39 \begin{verbatim}
40 Distributed under the GNU Public License. See the file COPYING.
41 Dedicated to the memory of William Schelter.
42 This is a development version of Maxima. The function bug_report()
43 provides bug reporting information.
44 (%i1)
45 \end{verbatim}
47 The {\tt (\%i1)} is a ``label''. Each input or output line is
48 labelled and can be referred to by its own label for the rest of the
49 session. {\tt i} labels denote your commands and {\tt o} labels
50 denote displays of the machine's response. \emph{Never use variable
51 names like {\tt \%i1} or {\tt \%o5}, as these will be confused with
52 the lines so labeled}.
54 Maxima distinguishes lower and upper case. All built-in functions
55 have names which are lowercase only ({\tt sin}, {\tt cos}, {\tt save},
56 {\tt load}, etc). Built-in constants have lowercase names ({\tt \%e},
57 {\tt \%pi}, {\tt inf}, etc). If you type {\tt SIN(x)} or {\tt
58 Sin(x)}, Maxima assumes you mean something other than the built-in
59 {\tt sin} function. User-defined functions and variables can have
60 names which are lower or upper case or both. {\tt foo(XY)}, {\tt
61 Foo(Xy)}, {\tt FOO(xy)} are all different.
64 \section{Special keys and symbols \label{sec:keys}}
66 \begin{enumerate}
67 \item To end a Maxima session, type {\tt quit();}.
69 \item To abort a computation without leaving Maxima, type \verb+^C+.
70 (Here \verb+^+ stands for the control key, so
71 that \verb+^C+ means first press the key marked control and hold it down while pressing the C key.)
72 It is important for you to
73 know how to do this in case, for example, you begin a computation which is taking too long.
74 For example:
75 % sum (1/x^2, x, 1, 10000);
76 % ^C
77 \begin{verbatim}
78 (%i1) sum (1/x^2, x, 1, 100000)$
80 Maxima encountered a Lisp error:
82 Interactive interrupt at #x7FFFF74A43C3.
84 Automatically continuing.
85 To enable the Lisp debugger set *debugger-hook* to nil.
86 (%i2)
87 \end{verbatim}
89 \item In order to tell Maxima that you have finished your command, use
90 the semicolon ({\tt ;}), followed by a return. Note that the return
91 key alone does not signal that you are done with your input.
93 \item An alternative input terminator to the semicolon ({\tt ;}) is
94 the dollar sign ({\tt \$}), which, however, supresses the display of
95 Maxima's computation. This is useful if you are computing some long
96 intermediate result, and you don't want to waste time having it
97 displayed on the screen.
99 %\item If you want to completely delete the current input line (and start this line fresh from the
100 %beginning), type a double question mark ({\tt ??}).
102 \item If you wish to repeat a command which you have already given,
103 say on line {\tt (\%i5)}, you may do so without typing it over again
104 by preceding its label with two single quotes ({\tt ''}), i.e., {\tt
105 ''\%i5}. (Note that simply inputing {\tt \%i5} will not do the job
106 --- try it.)
108 \item If you want to refer to the immediately preceding result
109 computed by Maxima, you can either use its {\tt o} label, or you can
110 use the special symbol percent ({\tt \%}).
112 \item The standard quantities $e$ (natural log base), $i$ (square root
113 of $-1$) and $\pi$ ($3.14159\ldots$) are respectively referred to as
114 \verb+%e+, \verb+%i+,
115 and \verb+%pi+. Note that the use of {\tt \%} here as a prefix
116 is completely unrelated to the use of {\tt \%} to refer to the
117 preceding result computed.
119 \item In order to assign a value to a variable, Maxima uses the colon
120 ({\tt :}), not the equal sign. The equal sign is used for
121 representing equations.
122 \end{enumerate}
124 \section{Arithmetic \label{sec:arithmetic}}
126 The common arithmetic operations are
127 \begin{description}
128 \item [{\tt +}] addition
129 \item [{\tt -}] subtraction
130 \item [{\tt *}] scalar multiplication
131 \item [{\tt /}] division
132 \item [{\tt \^}] or {\tt **} exponentiation
133 \item [{\tt .}] matrix multiplication
134 \item [{\tt sqrt(x)}] square root of {\tt x}.
135 \end{description}
136 Maxima's output is characterized by exact (rational) arithmetic. For example,
137 % 1/100 + 1/101;
138 \begin{verbatim}
139 (%i1) 1/100 + 1/101;
141 (%o1) -----
142 10100
143 \end{verbatim}
144 If irrational numbers are involved in a computation, they are kept in symbolic form:
145 % (1 + sqrt(2))^5;
146 % expand (%);
147 \begin{verbatim}
148 (%i2) (1 + sqrt(2))^5;
150 (%o2) (sqrt(2) + 1)
151 (%i3) expand (%);
153 (%o3) 3 2 + 5 sqrt(2) + 41
154 \end{verbatim}
155 However, it is often useful to express a result in decimal notation.
156 This may be accomplished by following the expression you want expanded
157 by ``{\tt ,numer}'':
158 % %, numer;
159 \begin{verbatim}
160 (%i4) %, numer;
161 (%o4) 82.01219330881977
162 \end{verbatim}
163 Note the use here of \verb+%+
164 to refer to the previous result. In this version of Maxima, {\tt
165 numer} gives 16 significant figures, of which the last is often
166 unreliable. However, Maxima can offer \emph{arbitrarily high
167 precision} by using the {\tt bfloat} function:
168 % bfloat (%o3);
169 \begin{verbatim}
170 (%i5) bfloat (%o3);
171 (%o5) 8.201219330881976b1
172 \end{verbatim}
173 The number of significant figures displayed is controlled by the
174 Maxima variable {\tt fpprec}, which has the default value of 16:
175 % fpprec;
176 \begin{verbatim}
177 (%i6) fpprec;
178 (%o6) 16
179 \end{verbatim}
180 Here we reset {\tt fpprec} to yield 100 digits:
181 % fpprec: 100;
182 % ''%i5;
183 \begin{verbatim}
184 (%i7) fpprec: 100;
185 (%o7) 100
186 (%i8) ''%i5;
187 (%o8) 8.20121933088197564152489730020812442785204843859314941221\
188 2371240173124187540110412666123849550160561b1
189 \end{verbatim}
190 Note the use of two single quotes ({\tt ''}) in {\tt (\%i8)} to repeat
191 command {\tt (\%i5)}. Maxima can handle very large numbers without
192 approximation:
193 % 100!;
194 \begin{verbatim}
195 (%i9) 100!;
196 (%o9) 9332621544394415268169923885626670049071596826438162146859\
197 2963895217599993229915608941463976156518286253697920827223758251\
198 185210916864000000000000000000000000
199 \end{verbatim}
201 \section{Algebra \label{sec:algebra}}
203 Maxima's importance as a computer tool to facilitate analytical
204 calculations becomes more evident when we see how easily it does
205 algebra for us. Here's an example in which a polynomial is expanded:
206 % (x + 3*y + x^2*y)^3;
207 % expand (%);
208 \begin{verbatim}
209 (%i1) (x + 3*y + x^2*y)^3;
211 (%o1) (x y + 3 y + x)
212 (%i2) expand (%);
213 6 3 4 3 2 3 3 5 2 3 2
214 (%o2) x y + 9 x y + 27 x y + 27 y + 3 x y + 18 x y
215 2 4 2 3
216 + 27 x y + 3 x y + 9 x y + x
217 \end{verbatim}
218 Now suppose we wanted to substitute {\tt 5/z} for {\tt x} in the above
219 expression:
221 \noindent\begin{minipage}{\textwidth}
222 % %o2, x=5/z;
223 \begin{verbatim}
224 (%i3) %o2, x=5/z;
225 2 3 2 3
226 135 y 675 y 225 y 2250 y 125 5625 y 1875 y
227 (%o3) ------ + ------ + ----- + ------- + --- + ------- + ------
228 z 2 2 3 3 4 4
229 z z z z z z
231 9375 y 15625 y 3
232 + ------- + -------- + 27 y
235 \end{verbatim}
236 \end{minipage}
237 The Maxima function {\tt ratsimp} will place this over a common denominator:
238 % ratsimp (%);
239 \begin{verbatim}
240 (%i4) ratsimp (%);
241 3 6 2 5 3 4
242 (%o4) (27 y z + 135 y z + (675 y + 225 y) z
243 2 3 3 2 2
244 + (2250 y + 125) z + (5625 y + 1875 y) z + 9375 y z
246 + 15625 y )/z
247 \end{verbatim}
248 Expressions may also be {\tt factor}ed:
249 % factor (%);
250 \begin{verbatim}
251 (%i5) factor (%);
253 (3 y z + 5 z + 25 y)
254 (%o5) ----------------------
257 \end{verbatim}
258 Maxima can obtain exact solutions to systems of nonlinear algebraic
259 equations. In this example we {\tt solve} three equations in the
260 three unknowns {\tt a}, {\tt b}, {\tt c}:
261 % a + b*c = 1;
262 % b - a*c = 0;
263 % a + b = 5;
264 % solve ([%o6, %o7, %o8], [a, b, c]);
265 \begin{verbatim}
266 (%i6) a + b*c = 1;
267 (%o6) b c + a = 1
268 (%i7) b - a*c = 0;
269 (%o7) b - a c = 0
270 (%i8) a + b = 5;
271 (%o8) b + a = 5
272 (%i9) solve ([%o6, %o7, %o8], [a, b, c]);
273 25 sqrt(79) %i + 25 5 sqrt(79) %i + 5
274 (%o9) [[a = -------------------, b = -----------------,
275 6 sqrt(79) %i - 34 sqrt(79) %i + 11
276 sqrt(79) %i + 1 25 sqrt(79) %i - 25
277 c = ---------------], [a = -------------------,
278 10 6 sqrt(79) %i + 34
279 5 sqrt(79) %i - 5 sqrt(79) %i - 1
280 b = -----------------, c = - ---------------]]
281 sqrt(79) %i - 11 10
282 \end{verbatim}
283 Note that the display consists of a ``list'', i.e., some expression
284 contained between two brackets {\tt [ \ldots ]}, which itself contains
285 two lists. Each of the latter contain a distinct solution to the
286 simultaneous equations.
288 Trigonometric identities are easy to manipulate in Maxima. The
289 function {\tt trigexpand} uses the sum-of-angles formulas to make the
290 argument inside each trig function as simple as possible:
291 % sin(u + v) * cos(u)^3;
292 % trigexpand (%);
293 \begin{verbatim}
294 (%i10) sin(u + v) * cos(u)^3;
296 (%o10) cos (u) sin(v + u)
297 (%i11) trigexpand (%);
299 (%o11) cos (u) (cos(u) sin(v) + sin(u) cos(v))
300 \end{verbatim}
301 The function {\tt trigreduce}, on the other hand, converts an
302 expression into a form which is a sum of terms, each of which contains
303 only a single {\tt sin} or {\tt cos}:
304 % trigreduce (%o10);
305 \begin{verbatim}
306 (%i12) trigreduce (%o10);
307 sin(v + 4 u) + sin(v - 2 u) 3 sin(v + 2 u) + 3 sin(v)
308 (%o12) --------------------------- + -------------------------
310 \end{verbatim}
311 The functions {\tt realpart} and {\tt imagpart} will return the real
312 and imaginary parts of a complex expression:
313 % w: 3 + k*%i;
314 % w^2 * %e^w;
315 % realpart (%);
316 \begin{verbatim}
317 (%i13) w: 3 + k*%i;
318 (%o13) %i k + 3
319 (%i14) w^2 * %e^w;
320 2 %i k + 3
321 (%o14) (%i k + 3) %e
322 (%i15) realpart (%);
323 3 2 3
324 (%o15) %e (9 - k ) cos(k) - 6 %e k sin(k)
325 \end{verbatim}
327 \section{Calculus \label{sec:calculus}}
329 Maxima can compute derivatives and integrals, expand in Taylor series,
330 take limits, and obtain exact solutions to ordinary differential
331 equations. We begin by defining the symbol {\tt f} to be the
332 following function of {\tt x}:
333 % f: x^3 * %e^(k*x) * sin(w*x);
334 \begin{verbatim}
335 (%i1) f: x^3 * %e^(k*x) * sin(w*x);
336 3 k x
337 (%o1) x %e sin(w x)
338 \end{verbatim}
339 We compute the derivative of {\tt f} with respect to {\tt x}:
340 % diff (f, x);
341 \begin{verbatim}
342 (%i2) diff (f, x);
343 3 k x 2 k x
344 (%o2) k x %e sin(w x) + 3 x %e sin(w x)
345 3 k x
346 + w x %e cos(w x)
347 \end{verbatim}
348 Now we find the indefinite integral of {\tt f} with respect to {\tt x}:
349 % integrate (f, x);
350 \begin{verbatim}
351 (%i3) integrate (f, x);
352 6 3 4 5 2 7 3
353 (%o3) (((k w + 3 k w + 3 k w + k ) x
354 6 2 4 4 2 6 2
355 + (3 w + 3 k w - 3 k w - 3 k ) x
356 4 3 2 5 4 2 2 4
357 + (- 18 k w - 12 k w + 6 k ) x - 6 w + 36 k w - 6 k )
358 k x 7 2 5 4 3 6 3
359 %e sin(w x) + ((- w - 3 k w - 3 k w - k w) x
360 5 3 3 5 2
361 + (6 k w + 12 k w + 6 k w) x
362 5 2 3 4 3 3 k x
363 + (6 w - 12 k w - 18 k w) x - 24 k w + 24 k w) %e
364 8 2 6 4 4 6 2 8
365 cos(w x))/(w + 4 k w + 6 k w + 4 k w + k )
366 \end{verbatim}
367 A slight change in syntax gives definite integrals:
368 % integrate (1/x^2, x, 1, inf);
369 % integrate (1/x, x, 0, inf);
370 \begin{verbatim}
371 (%i4) integrate (1/x^2, x, 1, inf);
372 (%o4) 1
373 (%i5) integrate (1/x, x, 0, inf);
375 defint: integral is divergent.
376 -- an error. To debug this try: debugmode(true);
377 \end{verbatim}
378 Next we define the symbol {\tt g} in terms of {\tt f} (previously
379 defined in {\tt \%i1}) and the hyperbolic sine function, and find its
380 Taylor series expansion (up to, say, order 3 terms) about the point
381 {\tt x = 0}:
383 \noindent\begin{minipage}{\textwidth}
384 % g: f / sinh(k*x)^4;
385 % taylor (g, x, 0, 3);
386 \begin{verbatim}
387 (%i6) g: f / sinh(k*x)^4;
388 3 k x
389 x %e sin(w x)
390 (%o6) -----------------
392 sinh (k x)
393 (%i7) taylor (g, x, 0, 3);
394 2 3 2 2 3 3
395 w w x (w k + w ) x (3 w k + w ) x
396 (%o7)/T/ -- + --- - -------------- - ---------------- + . . .
397 4 3 4 3
398 k k 6 k 6 k
399 \end{verbatim}
400 \end{minipage}
401 The limit of {\tt g} as {\tt x} goes to 0 is computed as follows:
402 % limit (g, x, 0);
403 \begin{verbatim}
404 (%i8) limit (g, x, 0);
406 (%o8) --
409 \end{verbatim}
410 Maxima also permits derivatives to be represented in unevaluated form
411 (note the quote):
412 % 'diff (y, x);
413 \begin{verbatim}
414 (%i9) 'diff (y, x);
416 (%o9) --
418 \end{verbatim}
419 The quote operator in {\tt (\%i9)} means ``do not evaluate''. Without
420 it, Maxima would have obtained 0:
421 % diff (y, x);
422 \begin{verbatim}
423 (%i10) diff (y, x);
424 (%o10) 0
425 \end{verbatim}
426 Using the quote operator we can write differential equations:
427 % 'diff (y, x, 2) + 'diff (y, x) + y;
428 \begin{verbatim}
429 (%i11) 'diff (y, x, 2) + 'diff (y, x) + y;
431 d y dy
432 (%o11) --- + -- + y
433 2 dx
435 \end{verbatim}
436 Maxima's {\tt ode2} function can solve first and second order ODE's:
437 % ode2 (%o11, y, x);
438 \begin{verbatim}
439 (%i12) ode2 (%o11, y, x);
440 - x/2 sqrt(3) x sqrt(3) x
441 (%o12) y = %e (%k1 sin(---------) + %k2 cos(---------))
443 \end{verbatim}
446 \newpage
447 \section{Matrix calculations \label{sec:matrix}}
449 Maxima can compute the determinant, inverse and eigenvalues and
450 eigenvectors of matrices which have symbolic elements (i.e., elements
451 which involve algebraic variables.) We begin by entering a matrix {\tt
452 m} element by element:
453 % m: entermatrix (3, 3);
454 \begin{verbatim}
455 (%i1) m: entermatrix (3, 3);
457 Is the matrix 1. Diagonal 2. Symmetric 3. Antisymmetric 4. General
458 Answer 1, 2, 3 or 4 :
460 Row 1 Column 1:
462 Row 1 Column 2:
464 Row 1 Column 3:
466 Row 2 Column 1:
468 Row 2 Column 2:
470 Row 2 Column 3:
472 Row 3 Column 1:
474 Row 3 Column 2:
476 Row 3 Column 3:
479 Matrix entered.
480 [ 0 1 a ]
482 (%o1) [ 1 0 1 ]
484 [ 1 1 0 ]
485 \end{verbatim}
486 Next we find its transpose, determinant and inverse:
487 % transpose (m);
488 % determinant (m);
489 % invert (m), detout;
490 \begin{verbatim}
491 (%i2) transpose (m);
492 [ 0 1 1 ]
494 (%o2) [ 1 0 1 ]
496 [ a 1 0 ]
497 (%i3) determinant (m);
498 (%o3) a + 1
499 (%i4) invert (m), detout;
500 [ - 1 a 1 ]
502 [ 1 - a a ]
504 [ 1 1 - 1 ]
505 (%o4) -----------------
506 a + 1
507 \end{verbatim}
508 In {\tt (\%i4)}, the modifier {\tt detout} keeps the determinant
509 outside the inverse. As a check, we multiply {\tt m} by its inverse
510 (note the use of the period to represent matrix multiplication):
511 % m . %o4;
512 % expand (%);
513 % factor (%);
514 \begin{verbatim}
515 (%i5) m . %o4;
516 [ - 1 a 1 ]
518 [ 1 - a a ]
519 [ 0 1 a ] [ ]
520 [ ] [ 1 1 - 1 ]
521 (%o5) [ 1 0 1 ] . -----------------
522 [ ] a + 1
523 [ 1 1 0 ]
524 (%i6) expand (%);
525 [ a 1 ]
526 [ ----- + ----- 0 0 ]
527 [ a + 1 a + 1 ]
529 [ a 1 ]
530 (%o6) [ 0 ----- + ----- 0 ]
531 [ a + 1 a + 1 ]
533 [ a 1 ]
534 [ 0 0 ----- + ----- ]
535 [ a + 1 a + 1 ]
536 (%i7) factor (%);
537 [ 1 0 0 ]
539 (%o7) [ 0 1 0 ]
541 [ 0 0 1 ]
542 \end{verbatim}
543 In order to find the eigenvalues and eigenvectors of {\tt m}, we use the function {\tt
544 eigenvectors}:
546 \noindent\begin{minipage}{\textwidth}
547 % eigenvectors (m);
548 \begin{verbatim}
549 (%i8) eigenvectors (m);
550 sqrt(4 a + 5) - 1 sqrt(4 a + 5) + 1
551 (%o8) [[[- -----------------, -----------------, - 1],
553 sqrt(4 a + 5) - 1 sqrt(4 a + 5) - 1
554 [1, 1, 1]], [[[1, - -----------------, - -----------------]],
555 2 a + 2 2 a + 2
556 sqrt(4 a + 5) + 1 sqrt(4 a + 5) + 1
557 [[1, -----------------, -----------------]], [[1, - 1, 0]]]]
558 2 a + 2 2 a + 2
559 \end{verbatim}
560 In {\tt \%o8}, the first triple gives the eigenvalues of {\tt m} and
561 the next gives their respective multiplicities (here each is
562 unrepeated). The next three triples give the corresponding
563 eigenvectors of {\tt m}. In order to extract from this expression
564 one of these eigenvectors, we may use the {\tt part} function:
565 % part (%, 2, 1, 1);
566 \begin{verbatim}
567 (%i9) part (%o23, 2, 1, 1);
568 sqrt(4 a + 5) - 1 sqrt(4 a + 5) - 1
569 (%o9) [1, - -----------------, - -----------------]
570 2 a + 2 2 a + 2
571 \end{verbatim}
572 \end{minipage}
574 \section{Programming in Maxima \label{sec:programming}}
576 So far, we have used Maxima in the interactive mode, rather like a
577 calculator. However, for computations which involve a repetitive
578 sequence of commands, it is better to execute a program. Here we
579 present a short sample program to calculate the critical points of a
580 function {\tt f} of two variables {\tt x} and {\tt y}. The program
581 cues the user to enter the function {\tt f}, then it computes the
582 partial derivatives $\mathtt{f_x}$ and $\mathtt{f_y}$, and then it
583 uses the Maxima command {\tt solve} to obtain solutions to
584 $\mathtt{f_x = f_y = 0}$. The program is written outside of Maxima
585 with a text editor, and then loaded into Maxima with the {\tt batch}
586 command. Here is the program listing:
587 \begin{verbatim}
588 /* --------------------------------------------------------------------------
589 this is file critpts.max:
590 as you can see, comments in maxima are like comments in C
592 Nelson Luis Dias, nldias@simepar.br
593 created 20000707
594 updated 20000707
595 --------------------------------------------------------------------------- */
596 critpts():=(
597 print("program to find critical points"),
598 /* ---------------------------------------------------------------------------
599 asks for a function
600 --------------------------------------------------------------------------- */
601 f:read("enter f(x,y)"),
602 /* ---------------------------------------------------------------------------
603 echoes it, to make sure
604 --------------------------------------------------------------------------- */
605 print("f = ",f),
606 /* ---------------------------------------------------------------------------
607 produces a list with the two partial derivatives of f
608 --------------------------------------------------------------------------- */
609 eqs:[diff(f,x),diff(f,y)],
610 /* ---------------------------------------------------------------------------
611 produces a list of unknowns
612 --------------------------------------------------------------------------- */
613 unk:[x,y],
614 /* ---------------------------------------------------------------------------
615 solves the system
616 --------------------------------------------------------------------------- */
617 solve(eqs,unk)
619 \end{verbatim}
620 The program (which is actually a function with no argument) is called
621 {\tt critpts}. Each line is a valid Maxima command which could be
622 executed from the keyboard, and which is separated by the next command
623 by a comma. The partial derivatives are stored in a variable named
624 {\tt eqs}, and the unknowns are stored in {\tt unk}. Here is a sample
625 run:
626 % batch ("critpts.max");
627 % critpts ();
628 \begin{verbatim}
629 (%i1) batch ("critpts.max");
631 batching #p/home/robert/tmp/maxima-clean/maxima/critpts.max
632 (%i2) critpts() := (print("program to find critical points"),
633 f : read("enter f(x,y)"), print("f = ", f),
634 eqs : [diff(f, x), diff(f, y)], unk : [x, y], solve(eqs, unk))
635 (%i3) critpts ();
636 program to find critical points
637 enter f(x,y)
638 %e^(x^3 + y^2)*(x + y);
640 y + x
641 f = (y + x) %e
642 (%o3) [[x = .4588955685487001 %i + .3589790871086935,
643 y = .4942017368275118 %i - .1225787367783657],
644 [x = .3589790871086935 - .4588955685487001 %i,
645 y = - .4942017368275118 %i - .1225787367783657],
646 [x = .4187542327234816 %i - .6923124204420268,
647 y = 0.455912070111699 - .8697262692814121 %i],
648 [x = - .4187542327234816 %i - .6923124204420268,
649 y = .8697262692814121 %i + 0.455912070111699]]
650 \end{verbatim}
652 \section{A partial list of Maxima functions}
654 See the Maxima reference manual {\tt doc/html/maxima\_toc.html} (under
655 the main Maxima installation directory). From Maxima itself, you can
656 use {\tt describe(\textit{function name})}.
658 \begin{description}
659 \item[{\tt allroots(a)}] Finds all the (generally complex) roots of
660 the polynomial equation {\tt A}, and lists them in {\tt numer}ical
661 format (i.e. to 16 significant figures).
662 \item[{\tt append(a,b)}] Appends the list {\tt b} to the list {\tt a},
663 resulting in a single list.
664 \item[{\tt batch(a)}] Loads and runs a program with filename {\tt a}.
665 \item[{\tt coeff(a,b,c)}] Gives the coefficient of {\tt b} raised to
666 the power {\tt c} in expression {\tt a}.
667 \item[{\tt concat(a,b)}] Creates the symbol {\tt ab}.
668 \item[{\tt cons(a,b)}] Adds {\tt a} to the list {\tt b} as its first element.
669 \item[{\tt demoivre(a)}] Transforms all complex exponentials in {\tt
670 a} to their trigonometric equivalents.
671 \item[{\tt denom(a)}] Gives the denominator of {\tt a}.
672 \item[{\tt depends(a,b)}] Declares {\tt a} to be a function of {\tt
673 b}. This is useful for writing unevaluated derivatives, as in
674 specifying differential equations.
675 \item[{\tt desolve(a,b)}] Attempts to solve a linear system {\tt a} of
676 ODE's for unknowns {\tt b} using Laplace transforms.
677 \item[{\tt determinant(a)}] Returns the determinant of the square
678 matrix {\tt a}.
679 \item[{\tt diff(a,b1,c1,b2,c2,\ldots,bn,cn)}] Gives the mixed partial
680 derivative of {\tt a} with respect to each {\tt bi}, {\tt ci} times.
681 For brevity, {\tt diff(a,b,1)} may be represented by {\tt
682 diff(a,b)}. {\tt 'diff(\ldots)} represents the unevaluated
683 derivative, useful in specifying a differential equation.
684 \item[{\tt eigenvalues(a)}] Returns two lists, the first being the
685 eigenvalues of the square matrix {\tt a}, and the second being their
686 respective multiplicities.
687 \item[{\tt eigenvectors(a)}] Does everything that {\tt eigenvalues}
688 does, and adds a list of the eigenvectors of {\tt a}.
689 \item[{\tt entermatrix(a,b)}] Cues the user to enter an $\mathtt{a}
690 \times\, \mathtt{b}$ matrix, element by element.
691 \item[{\tt ev(a,b1,b2,\ldots,bn)}] Evaluates {\tt a} subject to the
692 conditions {\tt bi}. In particular the {\tt bi} may be equations,
693 lists of equations (such as that returned by {\tt solve}), or
694 assignments, in which cases {\tt ev} ``plugs'' the {\tt bi} into
695 {\tt a}. The {\tt Bi} may also be words such as {\tt numer} (in
696 which case the result is returned in numerical format), {\tt detout}
697 (in which case any matrix inverses in {\tt a} are performed with the
698 determinant factored out), or {\tt diff} (in which case all
699 differentiations in {\tt a} are evaluated, i.e., {\tt 'diff} in {\tt
700 a} is replaced by {\tt diff}). For brevity in a manual command
701 (i.e., not inside a user-defined function), the {\tt ev} may be
702 dropped, shortening the syntax to {\tt a,b1,b2,\ldots,bn}.
703 \item[{\tt expand(a)}] Algebraically expands {\tt a}. In particular
704 multiplication is distributed over addition.
705 \item[{\tt exponentialize(a)}] Transforms all trigonometric functions
706 in {\tt a} to their complex exponential equivalents.
707 \item[{\tt factor(a)}] Factors {\tt a}.
708 \item[{\tt freeof(a,b)}] Is true if the variable {\tt a} is not part
709 of the expression {\tt b}.
710 \item[{\tt grind(a)}] Displays a variable or function {\tt a} in a
711 compact format. When used with {\tt writefile} and an editor
712 outside of Maxima, it offers a scheme for producing {\tt batch}
713 files which include Maxima-generated expressions.
714 \item[{\tt ident(a)}] Returns an $\mathtt{a} \times\, \mathtt{a}$
715 identity matrix.
716 \item[{\tt imagpart(a)}] Returns the imaginary part of {\tt a}.
717 \item[{\tt integrate(a,b)}] Attempts to find the indefinite integral
718 of {\tt a} with respect to {\tt b}.
719 \item[{\tt integrate(a,b,c,d)}] Attempts to find the indefinite
720 integral of {\tt a} with respect to {\tt b}. taken from
721 $\mathtt{b=c}$ to $\mathtt{b=d}$. The limits of integration {\tt c}
722 and {\tt d} may be taken as {\tt inf} (positive infinity) or {\tt
723 minf} (negative infinity).
724 \item[{\tt invert(a)}] Computes the inverse of the square matrix {\tt
726 \item[{\tt kill(a)}] Removes the variable {\tt a} with all its
727 assignments and properties from the current Maxima environment.
728 \item[{\tt limit(a,b,c)}] Gives the limit of expression {\tt a} as
729 variable {\tt b} approaches the value {\tt c}. The latter may be
730 taken as {\tt inf} or {\tt minf} as in {\tt integrate}.
731 \item[{\tt lhs(a)}] Gives the left-hand side of the equation {\tt a}.
732 \item[{\tt loadfile(a)}] Loads a disk file with filename {\tt a} from
733 the current default directory. The disk file must be in the proper
734 format (i.e. created by a {\tt save} command).
735 \item[{\tt makelist(a,b,c,d)}] Creates a list of {\tt a}'s (each of
736 which presumably depends on {\tt b}), concatenated from
737 $\mathtt{b=c}$ to $\mathtt{b=d}$
738 \item[{\tt map(a,b)}] Maps the function {\tt a} onto the
739 subexpressions of {\tt b}.
740 \item[{\tt matrix(a1,a2,\ldots,an)}] Creates a matrix consisting of the rows {\tt ai}, where each
741 row {\tt ai} is a list of {\tt m} elements, {\tt [b1, b2, \ldots, bm]}.
742 \item[{\tt num(a)}] Gives the numerator of {\tt a}.
743 \item[{\tt ode2(a,b,c)}] Attempts to solve the first- or second-order
744 ordinary differential equation {\tt a} for {\tt b} as a function of
745 {\tt c}.
746 \item[{\tt part(a,b1,b2,\ldots,bn)}] First takes the {\tt b1}th part
747 of {\tt a}, then the {\tt b2}th part of that, and so on.
748 \item[{\tt playback(a)}] Displays the last {\tt a} (an integer)
749 labels and their associated expressions. If {\tt a} is omitted,
750 all lines are played back. See the Manual for other options.
751 \item[{\tt ratsimp(a)}] Simplifies {\tt a} and returns a quotient of
752 two polynomials.
753 \item[{\tt realpart(a)}] Returns the real part of {\tt a}.
754 \item[{\tt rhs(a)}] Gives the right-hand side of the equation {\tt a}.
755 \item[{\tt save(a,b1,b2,\ldots, bn)}] Creates a disk file with
756 filename {\tt a} in the current default directory, of variables,
757 functions, or arrays {\tt bi}. The format of the file permits it to
758 be reloaded into Maxima using the {\tt loadfile} command.
759 Everything (including labels) may be {\tt save}d by taking {\tt b1}
760 equal to {\tt all}.
761 \item[{\tt solve(a,b)}] Attempts to solve the algebraic equation {\tt
762 a} for the unknown {\tt b}. A list of solution equations is
763 returned. For brevity, if {\tt a} is an equation of the form
764 $\mathtt{c = 0}$, it may be abbreviated simply by the expression
765 {\tt c}.
766 \item[{\tt string(a)}] Converts {\tt a} to Maxima's linear notation
767 (similar to Fortran's) just as if it had been typed in and puts {\tt
768 a} into the buffer for possible editing. The {\tt string}'ed
769 expression should not be used in a computation.
770 \item[{\tt stringout(a,b1,b2,\ldots,bn)}] Creates a disk file with
771 filename {\tt a} in the current default directory, of variables
772 (e.g. labels) {\tt bi}. The file is in a text format and is not
773 reloadable into Maxima. However the strungout expressions can be
774 incorporated into a Fortran, Basic or C program with a minimum of
775 editing.
776 \item[{\tt subst(a,b,c)}] Substitutes {\tt a} for {\tt b} in {\tt c}.
777 \item[{\tt taylor(a,b,c,d)}] Expands {\tt a} in a Taylor series in
778 {\tt b} about $\mathtt{b=c}$, up to and including the term
779 $\mathtt{(b-c)^d}$. Maxima also supports Taylor expansions in more
780 than one independent variable; see the Manual for details.
781 \item[{\tt transpose(a)}] Gives the transpose of the matrix {\tt a}.
782 \item[{\tt trigexpand(a)}] Is a trig simplification function which
783 uses the sum-of-angles formulas to simplify the arguments of
784 individual {\tt sin}'s or {\tt cos}'s. For example, {\tt
785 trigexpand(sin(x+y))} gives {\tt cos(x) sin(y) + sin(x) cos(y)}.
786 \item[{\tt trigreduce(a)}] Is a trig simplification function which
787 uses trig identities to convert products and powers of {\tt sin} and
788 {\tt cos} into a sum of terms, each of which contains only a single
789 {\tt sin} or {\tt cos}. For example, \verb+trigreduce(sin(x)^2)+
790 gives {\tt (1 - cos(2x))/2}.
791 \item[{\tt trigsimp(a)}] Is a trig simplification function which
792 replaces {\tt tan}, {\tt sec}, etc., by their {\tt sin} and {\tt
793 cos} equivalents. It also uses the identity $\mathtt{sin()^2 +
794 cos()^2 = 1}$.
795 \end{description}
799 \end{document}