1 <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Transitional//EN"
2 "http://www.w3.org/TR/REC-html40/loose.dtd">
4 <meta name=
"GENERATOR" content=
"TtH 4.03">
5 <style type=
"text/css"> div
.p
{ margin-top: 7pt;}</style>
6 <style type=
"text/css"><!--
7 td div
.comp
{ margin-top: -0.6ex; margin-bottom: -1ex;}
8 td div
.comb
{ margin-top: -0.6ex; margin-bottom: -.6ex;}
9 td div
.hrcomp
{ line-height: 0.9; margin-top: -0.8ex; margin-bottom: -1ex;}
10 td div
.norm
{line-height:normal
;}
11 span
.roman
{font-family: serif
; font-style: normal
; font-weight: normal
;}
12 span
.overacc2
{position: relative
; left: .8em; top: -1.2ex;}
13 span
.overacc1
{position: relative
; left: .6em; top: -1.2ex;} --></style>
14 <style type=
"text/css"><!--
15 .tiny {font-size:30%;}
16 .scriptsize {font-size:xx-small
;}
17 .footnotesize {font-size:x-small
;}
18 .smaller {font-size:smaller
;}
19 .small {font-size:small
;}
20 .normalsize {font-size:medium
;}
21 .large {font-size:large
;}
22 .larger {font-size:x-large
;}
23 .largerstill {font-size:xx-large
;}
24 .huge {font-size:300%;}
29 <title> Introduction to Maxima
</title>
31 <h1 align=
"center">Introduction to Maxima
</h1>
33 <h3 align=
"center">Richard H. Rand
<br />
34 Dept. of Theoretical and Applied Mechanics, Cornell University
35 <a href=
"#tthFtNtAAB" name=
"tthFrefAAB"><sup>1</sup></a> </h3>
37 <h3 align=
"center"> </h3>
39 <div class=
"p"><!----></div>
40 Copyright (c)
1988-
2010 Richard H. Rand.
42 <div class=
"p"><!----></div>
43 This document is free; you can redistribute it and/or modify it under
44 the terms of the GNU General Public License as published by the Free
45 Software Foundation. See the GNU General Public License for more
46 details at http://www.gnu.org/copyleft/gpl.html
48 <div class=
"p"><!----></div>
49 <a name=
"tth_sEc1"></a><h2>
50 1 Introduction
<a name=
"sec:introduction">
53 <div class=
"p"><!----></div>
54 To invoke Maxima in a console, type
57 maxima
<enter
>
61 <div class=
"p"><!----></div>
62 The computer will display a greeting of the sort:
65 Distributed
under
the
GNU
Public
License.
See
the
file
COPYING.
66 Dedicated
to
the
memory
of
William
Schelter.
67 This
is
a
development
version
of
Maxima.
The
function
bug_report()
68 provides
bug
reporting
information.
73 <div class=
"p"><!----></div>
74 The
<tt>(%i1)
</tt> is a
"label". Each input or output line is
75 labelled and can be referred to by its own label for the rest of the
76 session.
<tt>i
</tt> labels denote your commands and
<tt>o
</tt> labels
77 denote displays of the machine's response.
<em>Never use variable
78 names like
<tt>%i1
</tt> or
<tt>%o5
</tt>, as these will be confused with
79 the lines so labeled
</em>.
81 <div class=
"p"><!----></div>
82 Maxima distinguishes lower and upper case. All built-in functions
83 have names which are lowercase only (
<tt>sin
</tt>,
<tt>cos
</tt>,
<tt>save
</tt>,
84 <tt>load
</tt>, etc). Built-in constants have lowercase names (
<tt>%e
</tt>,
85 <tt>%pi
</tt>,
<tt>inf
</tt>, etc). If you type
<tt>SIN(x)
</tt> or
<tt>
86 Sin(x)
</tt>, Maxima assumes you mean something other than the built-in
87 <tt>sin
</tt> function. User-defined functions and variables can have
88 names which are lower or upper case or both.
<tt>foo(XY)
</tt>,
<tt>
89 Foo(Xy)
</tt>,
<tt>FOO(xy)
</tt> are all different.
91 <div class=
"p"><!----></div>
92 <a name=
"tth_sEc2"></a><h2>
93 2 Special keys and symbols
<a name=
"sec:keys">
96 <div class=
"p"><!----></div>
99 <li> To end a Maxima session, type
<tt>quit();
</tt>.
100 <div class=
"p"><!----></div>
103 <li> To abort a computation without leaving Maxima, type
<tt>^C
</tt>.
104 (Here
<tt>^
</tt> stands for the control key, so
105 that
<tt>^C
</tt> means first press the key marked control and hold it down while pressing the C key.)
106 It is important for you to
107 know how to do this in case, for example, you begin a computation which is taking too long.
111 (%i1)
sum
(
1/x^
2,
x,
1,
100000)$
113 Maxima
encountered
a
Lisp
error:
115 Interactive
interrupt
at
#x7FFFF74A43C3.
117 Automatically
continuing.
118 To
enable
the
Lisp
debugger
set
*debugger-hook*
to
nil.
122 <div class=
"p"><!----></div>
125 <li> In order to tell Maxima that you have finished your command, use
126 the semicolon (
<tt>;
</tt>), followed by a return. Note that the return
127 key alone does not signal that you are done with your input.
128 <div class=
"p"><!----></div>
131 <li> An alternative input terminator to the semicolon (
<tt>;
</tt>) is
132 the dollar sign (
<tt>$
</tt>), which, however, suppresses the display of
133 Maxima's computation. This is useful if you are computing some long
134 intermediate result, and you don't want to waste time having it
135 displayed on the screen.
136 <div class=
"p"><!----></div>
139 <li> If you wish to repeat a command which you have already given,
140 say on line
<tt>(%i5)
</tt>, you may do so without typing it over again
141 by preceding its label with two single quotes (
<tt>"</tt>), i.e., <tt>
142 "%i5
</tt>. (Note that simply inputing
<tt>%i5
</tt> will not do the job
144 <div class=
"p"><!----></div>
147 <li> If you want to refer to the immediately preceding result
148 computed by Maxima, you can either use its
<tt>o
</tt> label, or you can
149 use the special symbol percent (
<tt>%
</tt>).
150 <div class=
"p"><!----></div>
153 <li> The standard quantities e (natural log base), i (square root
154 of
−1) and
π (
3.14159…) are respectively referred to as
155 <tt>%e
</tt>,
<tt>%i
</tt>,
156 and
<tt>%pi
</tt>. Note that the use of
<tt>%
</tt> here as a prefix
157 is completely unrelated to the use of
<tt>%
</tt> to refer to the
158 preceding result computed.
159 <div class=
"p"><!----></div>
162 <li> In order to assign a value to a variable, Maxima uses the colon
163 (
<tt>:
</tt>), not the equal sign. The equal sign is used for
164 representing equations.
165 <div class=
"p"><!----></div>
169 <div class=
"p"><!----></div>
170 <a name=
"tth_sEc3"></a><h2>
171 3 Arithmetic
<a name=
"sec:arithmetic">
174 <div class=
"p"><!----></div>
175 The common arithmetic operations are
178 <dt><b><tt>+
</tt></b></dt>
180 <dt><b><tt>-
</tt></b></dt>
181 <dd> subtraction
</dd>
182 <dt><b><tt>*
</tt></b></dt>
183 <dd> scalar multiplication
</dd>
184 <dt><b><tt>/
</tt></b></dt>
186 <dt><b><tt>^
</tt></b></dt>
187 <dd> or
<tt>**
</tt> exponentiation
</dd>
188 <dt><b><tt>.
</tt></b></dt>
189 <dd> matrix multiplication
</dd>
190 <dt><b><tt>sqrt(x)
</tt></b></dt>
191 <dd> square root of
<tt>x
</tt>.
</dd>
193 Maxima's output is characterized by exact (rational) arithmetic. For example,
196 (%i1)
1/
100 +
1/
101;
197 201
198 (%o1)
-----
199 10100
202 If irrational numbers are involved in a computation, they are kept in symbolic form:
205 (%i2)
(
1 +
sqrt(
2))^
5;
206 5
207 (%o2)
(sqrt(
2)
+
1)
208 (%i3)
expand
(%);
209 7/
2
210 (%o3)
3 2 +
5 sqrt(
2)
+
41
213 However, it is often useful to express a result in decimal notation.
214 This may be accomplished by following the expression you want expanded
215 by
"<tt>,numer</tt>":
218 (%i4)
%,
numer;
219 (%o4)
82.01219330881977
222 Note the use here of
<tt>%
</tt>
223 to refer to the previous result. In this version of Maxima,
<tt>
224 numer
</tt> gives
16 significant figures, of which the last is often
225 unreliable. However, Maxima can offer
<em>arbitrarily high
226 precision
</em> by using the
<tt>bfloat
</tt> function:
229 (%i5)
bfloat
(%o3);
230 (%o5)
8.201219330881976b1
233 The number of significant figures displayed is controlled by the
234 Maxima variable
<tt>fpprec
</tt>, which has the default value of
16:
238 (%o6)
16
241 Here we reset
<tt>fpprec
</tt> to yield
100 digits:
244 (%i7)
fpprec:
100;
245 (%o7)
100
247 (%o8)
8.20121933088197564152489730020812442785204843859314941221\
248 2371240173124187540110412666123849550160561b1
251 Note the use of two single quotes (
<tt>"</tt>) in <tt>(%i8)</tt> to repeat
252 command <tt>(%i5)</tt>. Maxima can handle very large numbers without
257 (%o9) 9332621544394415268169923885626670049071596826438162146859\
258 2963895217599993229915608941463976156518286253697920827223758251\
259 185210916864000000000000000000000000
263 <div class="p
"><!----></div>
264 <a name="tth_sEc4
"></a><h2>
265 4 Algebra <a name="sec:algebra
">
268 <div class="p
"><!----></div>
269 Maxima's importance as a computer tool to facilitate analytical
270 calculations becomes more evident when we see how easily it does
271 algebra for us. Here's an example in which a polynomial is expanded:
274 (%i1) (x + 3*y + x^2*y)^3;
275 2 3
276 (%o1) (x y + 3 y + x)
277 (%i2) expand (%);
278 6 3 4 3 2 3 3 5 2 3 2
279 (%o2) x y + 9 x y + 27 x y + 27 y + 3 x y + 18 x y
280 2 4 2 3
281 + 27 x y + 3 x y + 9 x y + x
284 Now suppose we wanted to substitute <tt>5/z</tt> for <tt>x</tt> in the above
287 <div class="p
"><!----></div>
288 <table border="0"><tr><td></td><td><table border="0"><tr><td></td><td width="1000">
291 (%i3) %o2, x=5/z;
292 2 3 2 3
293 135 y 675 y 225 y 2250 y 125 5625 y 1875 y
294 (%o3) ------ + ------ + ----- + ------- + --- + ------- + ------
295 z 2 2 3 3 4 4
296 z z z z z z
297 2 3
298 9375 y 15625 y 3
299 + ------- + -------- + 27 y
300 5 6
301 z z
305 </td></tr></table><!--vbox-->
306 </td><td></td></tr></table><!--hboxt-->The Maxima function <tt>ratsimp</tt> will place this over a common denominator:
309 (%i4) ratsimp (%);
310 3 6 2 5 3 4
311 (%o4) (27 y z + 135 y z + (675 y + 225 y) z
312 2 3 3 2 2
313 + (2250 y + 125) z + (5625 y + 1875 y) z + 9375 y z
314 3 6
315 + 15625 y )/z
318 Expressions may also be <tt>factor</tt>ed:
321 (%i5) factor (%);
322 2 3
323 (3 y z + 5 z + 25 y)
324 (%o5) ----------------------
325 6
326 z
329 Maxima can obtain exact solutions to systems of nonlinear algebraic
330 equations. In this example we <tt>solve</tt> three equations in the
331 three unknowns <tt>a</tt>, <tt>b</tt>, <tt>c</tt>:
334 (%i6) a + b*c = 1;
335 (%o6) b c + a = 1
336 (%i7) b - a*c = 0;
337 (%o7) b - a c = 0
338 (%i8) a + b = 5;
339 (%o8) b + a = 5
340 (%i9) solve ([%o6, %o7, %o8], [a, b, c]);
341 sqrt(79) %i - 11 sqrt(79) %i + 9
342 (%o9) [[a = - ----------------, b = ---------------,
343 4 4
344 sqrt(79) %i + 1 sqrt(79) %i + 11
345 c = ---------------], [a = ----------------,
346 10 4
347 sqrt(79) %i - 9 sqrt(79) %i - 1
348 b = - ---------------, c = - ---------------]]
349 4 10
352 Note that the display consists of a "list
", i.e., some expression
353 contained between two brackets <tt>[ ... ]</tt>, which itself contains
354 two lists. Each of the latter contain a distinct solution to the
355 simultaneous equations.
357 <div class="p
"><!----></div>
358 Trigonometric identities are easy to manipulate in Maxima. The
359 function <tt>trigexpand</tt> uses the sum-of-angles formulas to make the
360 argument inside each trig function as simple as possible:
363 (%i10) sin(u + v) * cos(u)^3;
364 3
365 (%o10) cos (u) sin(v + u)
366 (%i11) trigexpand (%);
367 3
368 (%o11) cos (u) (cos(u) sin(v) + sin(u) cos(v))
371 The function <tt>trigreduce</tt>, on the other hand, converts an
372 expression into a form which is a sum of terms, each of which contains
373 only a single <tt>sin</tt> or <tt>cos</tt>:
376 (%i12) trigreduce (%o10);
377 sin(v + 4 u) + sin(v - 2 u) 3 sin(v + 2 u) + 3 sin(v)
378 (%o12) --------------------------- + -------------------------
379 8 8
382 The functions <tt>realpart</tt> and <tt>imagpart</tt> will return the real
383 and imaginary parts of a complex expression:
386 (%i13) w: 3 + k*%i;
387 (%o13) %i k + 3
388 (%i14) w^2 * %e^w;
389 2 %i k + 3
390 (%o14) (%i k + 3) %e
391 (%i15) realpart (%);
392 3 2 3
393 (%o15) %e (9 - k ) cos(k) - 6 %e k sin(k)
397 <div class="p
"><!----></div>
398 <a name="tth_sEc5
"></a><h2>
399 5 Calculus <a name="sec:calculus
">
402 <div class="p
"><!----></div>
403 Maxima can compute derivatives and integrals, expand in Taylor series,
404 take limits, and obtain exact solutions to ordinary differential
405 equations. We begin by defining the symbol <tt>f</tt> to be the
406 following function of <tt>x</tt>:
409 (%i1) f: x^3 * %e^(k*x) * sin(w*x);
410 3 k x
411 (%o1) x %e sin(w x)
414 We compute the derivative of <tt>f</tt> with respect to <tt>x</tt>:
417 (%i2) diff (f, x);
418 3 k x 2 k x
419 (%o2) k x %e sin(w x) + 3 x %e sin(w x)
420 3 k x
421 + w x %e cos(w x)
424 Now we find the indefinite integral of <tt>f</tt> with respect to <tt>x</tt>:
427 (%i3) integrate (f, x);
428 6 3 4 5 2 7 3
429 (%o3) (((k w + 3 k w + 3 k w + k ) x
430 6 2 4 4 2 6 2
431 + (3 w + 3 k w - 3 k w - 3 k ) x
432 4 3 2 5 4 2 2 4
433 + (- 18 k w - 12 k w + 6 k ) x - 6 w + 36 k w - 6 k )
434 k x 7 2 5 4 3 6 3
435 %e sin(w x) + ((- w - 3 k w - 3 k w - k w) x
436 5 3 3 5 2
437 + (6 k w + 12 k w + 6 k w) x
438 5 2 3 4 3 3 k x
439 + (6 w - 12 k w - 18 k w) x - 24 k w + 24 k w) %e
440 8 2 6 4 4 6 2 8
441 cos(w x))/(w + 4 k w + 6 k w + 4 k w + k )
444 A slight change in syntax gives definite integrals:
447 (%i4) integrate (1/x^2, x, 1, inf);
448 (%o4) 1
449 (%i5) integrate (1/x, x, 0, inf);
451 defint: integral is divergent.
452 -- an error. To debug this try: debugmode(true);
455 Next we define the symbol <tt>g</tt> in terms of <tt>f</tt> (previously
456 defined in <tt>%i1</tt>) and the hyperbolic sine function, and find its
457 Taylor series expansion (up to, say, order 3 terms) about the point
460 <div class="p
"><!----></div>
461 <table border="0"><tr><td></td><td><table border="0"><tr><td></td><td width="1000">
464 (%i6) g: f / sinh(k*x)^4;
465 3 k x
466 x %e sin(w x)
467 (%o6) -----------------
468 4
469 sinh (k x)
470 (%i7) taylor (g, x, 0, 3);
471 2 3 2 2 3 3
472 w w x (w k + w ) x (3 w k + w ) x
473 (%o7)/T/ -- + --- - -------------- - ---------------- + . . .
474 4 3 4 3
475 k k 6 k 6 k
479 </td></tr></table><!--vbox-->
480 </td><td></td></tr></table><!--hboxt-->The limit of <tt>g</tt> as <tt>x</tt> goes to 0 is computed as follows:
483 (%i8) limit (g, x, 0);
484 w
485 (%o8) --
486 4
487 k
490 Maxima also permits derivatives to be represented in unevaluated form
494 (%i9) 'diff (y, x);
495 dy
496 (%o9) --
497 dx
500 The quote operator in <tt>(%i9)</tt> means "do not evaluate
". Without
501 it, Maxima would have obtained 0:
504 (%i10) diff (y, x);
505 (%o10) 0
508 Using the quote operator we can write differential equations:
511 (%i11) 'diff (y, x, 2) + 'diff (y, x) + y;
512 2
513 d y dy
514 (%o11) --- + -- + y
515 2 dx
516 dx
519 Maxima's <tt>ode2</tt> function can solve first and second order ODE's:
522 (%i12) ode2 (%o11, y, x);
523 - x/2 sqrt(3) x sqrt(3) x
524 (%o12) y = %e (%k1 sin(---------) + %k2 cos(---------))
525 2 2
529 <div class="p
"><!----></div>
530 <a name="tth_sEc6
"></a><h2>
531 6 Matrix calculations <a name="sec:matrix
">
534 <div class="p
"><!----></div>
535 Maxima can compute the determinant, inverse and eigenvalues and
536 eigenvectors of matrices which have symbolic elements (i.e., elements
537 which involve algebraic variables.) We begin by entering a matrix <tt>
538 m</tt> element by element:
541 (%i1) m: entermatrix (3, 3);
543 Is the matrix 1. Diagonal 2. Symmetric 3. Antisymmetric 4. General
544 Answer 1, 2, 3 or 4 :
546 Row 1 Column 1:
548 Row 1 Column 2:
550 Row 1 Column 3:
552 Row 2 Column 1:
554 Row 2 Column 2:
556 Row 2 Column 3:
558 Row 3 Column 1:
560 Row 3 Column 2:
562 Row 3 Column 3:
566 [ 0 1 a ]
567 [ ]
568 (%o1) [ 1 0 1 ]
569 [ ]
570 [ 1 1 0 ]
573 Next we find its transpose, determinant and inverse:
576 (%i2) transpose (m);
577 [ 0 1 1 ]
578 [ ]
579 (%o2) [ 1 0 1 ]
580 [ ]
581 [ a 1 0 ]
582 (%i3) determinant (m);
583 (%o3) a + 1
584 (%i4) invert (m), detout;
585 [ - 1 a 1 ]
586 [ ]
587 [ 1 - a a ]
588 [ ]
589 [ 1 1 - 1 ]
590 (%o4) -----------------
591 a + 1
594 In <tt>(%i4)</tt>, the modifier <tt>detout</tt> keeps the determinant
595 outside the inverse. As a check, we multiply <tt>m</tt> by its inverse
596 (note the use of the period to represent matrix multiplication):
599 (%i5) m . %o4;
600 [ - 1 a 1 ]
601 [ ]
602 [ 1 - a a ]
603 [ 0 1 a ] [ ]
604 [ ] [ 1 1 - 1 ]
605 (%o5) [ 1 0 1 ] . -----------------
606 [ ] a + 1
607 [ 1 1 0 ]
608 (%i6) expand (%);
609 [ a 1 ]
610 [ ----- + ----- 0 0 ]
611 [ a + 1 a + 1 ]
612 [ ]
613 [ a 1 ]
614 (%o6) [ 0 ----- + ----- 0 ]
615 [ a + 1 a + 1 ]
616 [ ]
617 [ a 1 ]
618 [ 0 0 ----- + ----- ]
619 [ a + 1 a + 1 ]
620 (%i7) factor (%);
621 [ 1 0 0 ]
622 [ ]
623 (%o7) [ 0 1 0 ]
624 [ ]
625 [ 0 0 1 ]
628 In order to find the eigenvalues and eigenvectors of <tt>m</tt>, we use the function <tt>
631 <div class="p
"><!----></div>
632 <table border="0"><tr><td></td><td><table border="0"><tr><td></td><td width="1000">
635 (%i8) eigenvectors (m);
636 sqrt(4 a + 5) - 1 sqrt(4 a + 5) + 1
637 (%o8) [[[- -----------------, -----------------, - 1],
638 2 2
639 sqrt(4 a + 5) - 1 sqrt(4 a + 5) - 1
640 [1, 1, 1]], [[[1, - -----------------, - -----------------]],
641 2 a + 2 2 a + 2
642 sqrt(4 a + 5) + 1 sqrt(4 a + 5) + 1
643 [[1, -----------------, -----------------]], [[1, - 1, 0]]]]
644 2 a + 2 2 a + 2
647 In <tt>%o8</tt>, the first triple gives the eigenvalues of <tt>m</tt> and
648 the next gives their respective multiplicities (here each is
649 unrepeated). The next three triples give the corresponding
650 eigenvectors of <tt>m</tt>. In order to extract from this expression
651 one of these eigenvectors, we may use the <tt>part</tt> function:
654 (%i9) part (%o23, 2, 1, 1);
655 sqrt(4 a + 5) - 1 sqrt(4 a + 5) - 1
656 (%o9) [1, - -----------------, - -----------------]
657 2 a + 2 2 a + 2
661 </td></tr></table><!--vbox-->
662 </td><td></td></tr></table><!--hboxt--> <a name="tth_sEc7
"></a><h2>
663 7 Programming in Maxima <a name="sec:programming
">
666 <div class="p
"><!----></div>
667 So far, we have used Maxima in the interactive mode, rather like a
668 calculator. However, for computations which involve a repetitive
669 sequence of commands, it is better to execute a program. Here we
670 present a short sample program to calculate the critical points of a
671 function <tt>f</tt> of two variables <tt>x</tt> and <tt>y</tt>. The program
672 cues the user to enter the function <tt>f</tt>, then it computes the
673 partial derivatives <tt>f</tt><sub><tt>x</tt></sub> and <tt>f</tt><sub><tt>y</tt></sub>, and then it
674 uses the Maxima command <tt>solve</tt> to obtain solutions to
675 <tt>f</tt><sub><tt>x</tt></sub><tt> = </tt><tt>f</tt><sub><tt>y</tt></sub><tt> = </tt><tt>0</tt>. The program is written outside of Maxima
676 with a text editor, and then loaded into Maxima with the <tt>batch</tt>
677 command. Here is the program listing:
680 /* --------------------------------------------------------------------------
681 this is file critpts.max:
682 as you can see, comments in maxima are like comments in C
684 Nelson Luis Dias, nldias@simepar.br
685 created 20000707
686 updated 20000707
687 --------------------------------------------------------------------------- */
689 print("program
to
find
critical
points
"),
690 /* ---------------------------------------------------------------------------
691 asks for a function
692 --------------------------------------------------------------------------- */
693 f:read("enter
f(x,y)
"),
694 /* ---------------------------------------------------------------------------
695 echoes it, to make sure
696 --------------------------------------------------------------------------- */
697 print("f
=
",f),
698 /* ---------------------------------------------------------------------------
699 produces a list with the two partial derivatives of f
700 --------------------------------------------------------------------------- */
701 eqs:[diff(f,x),diff(f,y)],
702 /* ---------------------------------------------------------------------------
703 produces a list of unknowns
704 --------------------------------------------------------------------------- */
705 unk:[x,y],
706 /* ---------------------------------------------------------------------------
707 solves the system
708 --------------------------------------------------------------------------- */
709 solve(eqs,unk)
713 The program (which is actually a function with no argument) is called
714 <tt>critpts</tt>. Each line is a valid Maxima command which could be
715 executed from the keyboard, and which is separated by the next command
716 by a comma. The partial derivatives are stored in a variable named
717 <tt>eqs</tt>, and the unknowns are stored in <tt>unk</tt>. Here is a sample
721 (%i1) batch ("critpts.max
");
723 batching #p/home/robert/tmp/maxima-clean/maxima/critpts.max
724 (%i2) critpts() := (print("program
to
find
critical
points
"),
725 f : read("enter
f(x,y)
"), print("f
=
", f),
726 eqs : [diff(f, x), diff(f, y)], unk : [x, y], solve(eqs, unk))
727 (%i3) critpts ();
728 program to find critical points
729 enter f(x,y)
730 %e^(x^3 + y^2)*(x + y);
731 2 3
732 y + x
733 f = (y + x) %e
734 (%o3) [[x = .4588955685487001 %i + .3589790871086935,
735 y = .4942017368275118 %i - .1225787367783657],
736 [x = .3589790871086935 - .4588955685487001 %i,
737 y = - .4942017368275118 %i - .1225787367783657],
738 [x = .4187542327234816 %i - .6923124204420268,
739 y = 0.455912070111699 - .8697262692814121 %i],
740 [x = - .4187542327234816 %i - .6923124204420268,
741 y = .8697262692814121 %i + 0.455912070111699]]
745 <div class="p
"><!----></div>
746 <a name="tth_sEc8
"></a><h2>
747 8 A partial list of Maxima functions</h2>
749 <div class="p
"><!----></div>
750 See the Maxima reference manual <tt>doc/html/maxima_toc.html</tt> (under
751 the main Maxima installation directory). From Maxima itself, you can
752 use <tt>describe(<i>function name</i>)</tt>.
754 <div class="p
"><!----></div>
757 <dt><b><tt>allroots(a)</tt></b></dt>
758 <dd> Finds all the (generally complex) roots of
759 the polynomial equation <tt>A</tt>, and lists them in <tt>numer</tt>ical
760 format (i.e. to 16 significant figures).</dd>
761 <dt><b><tt>append(a,b)</tt></b></dt>
762 <dd> Appends the list <tt>b</tt> to the list <tt>a</tt>,
763 resulting in a single list.</dd>
764 <dt><b><tt>batch(a)</tt></b></dt>
765 <dd> Loads and runs a program with filename <tt>a</tt>.</dd>
766 <dt><b><tt>coeff(a,b,c)</tt></b></dt>
767 <dd> Gives the coefficient of <tt>b</tt> raised to
768 the power <tt>c</tt> in expression <tt>a</tt>.</dd>
769 <dt><b><tt>concat(a,b)</tt></b></dt>
770 <dd> Creates the symbol <tt>ab</tt>.</dd>
771 <dt><b><tt>cons(a,b)</tt></b></dt>
772 <dd> Adds <tt>a</tt> to the list <tt>b</tt> as its first element.</dd>
773 <dt><b><tt>demoivre(a)</tt></b></dt>
774 <dd> Transforms all complex exponentials in <tt>
775 a</tt> to their trigonometric equivalents.</dd>
776 <dt><b><tt>denom(a)</tt></b></dt>
777 <dd> Gives the denominator of <tt>a</tt>.</dd>
778 <dt><b><tt>depends(a,b)</tt></b></dt>
779 <dd> Declares <tt>a</tt> to be a function of <tt>
780 b</tt>. This is useful for writing unevaluated derivatives, as in
781 specifying differential equations.</dd>
782 <dt><b><tt>desolve(a,b)</tt></b></dt>
783 <dd> Attempts to solve a linear system <tt>a</tt> of
784 ODE's for unknowns <tt>b</tt> using Laplace transforms.</dd>
785 <dt><b><tt>determinant(a)</tt></b></dt>
786 <dd> Returns the determinant of the square
787 matrix <tt>a</tt>.</dd>
788 <dt><b><tt>diff(a,b1,c1,b2,c2,...,bn,cn)</tt></b></dt>
789 <dd> Gives the mixed partial
790 derivative of <tt>a</tt> with respect to each <tt>bi</tt>, <tt>ci</tt> times.
791 For brevity, <tt>diff(a,b,1)</tt> may be represented by <tt>
792 diff(a,b)</tt>. <tt>'diff(...)</tt> represents the unevaluated
793 derivative, useful in specifying a differential equation.</dd>
794 <dt><b><tt>eigenvalues(a)</tt></b></dt>
795 <dd> Returns two lists, the first being the
796 eigenvalues of the square matrix <tt>a</tt>, and the second being their
797 respective multiplicities.</dd>
798 <dt><b><tt>eigenvectors(a)</tt></b></dt>
799 <dd> Does everything that <tt>eigenvalues</tt>
800 does, and adds a list of the eigenvectors of <tt>a</tt>.</dd>
801 <dt><b><tt>entermatrix(a,b)</tt></b></dt>
802 <dd> Cues the user to enter an <tt>a</tt> × <tt>b</tt> matrix, element by element.</dd>
803 <dt><b><tt>ev(a,b1,b2,...,bn)</tt></b></dt>
804 <dd> Evaluates <tt>a</tt> subject to the
805 conditions <tt>bi</tt>. In particular the <tt>bi</tt> may be equations,
806 lists of equations (such as that returned by <tt>solve</tt>), or
807 assignments, in which cases <tt>ev</tt> "plugs
" the <tt>bi</tt> into
808 <tt>a</tt>. The <tt>Bi</tt> may also be words such as <tt>numer</tt> (in
809 which case the result is returned in numerical format), <tt>detout</tt>
810 (in which case any matrix inverses in <tt>a</tt> are performed with the
811 determinant factored out), or <tt>diff</tt> (in which case all
812 differentiations in <tt>a</tt> are evaluated, i.e., <tt>'diff</tt> in <tt>
813 a</tt> is replaced by <tt>diff</tt>). For brevity in a manual command
814 (i.e., not inside a user-defined function), the <tt>ev</tt> may be
815 dropped, shortening the syntax to <tt>a,b1,b2,...,bn</tt>.</dd>
816 <dt><b><tt>expand(a)</tt></b></dt>
817 <dd> Algebraically expands <tt>a</tt>. In particular
818 multiplication is distributed over addition.</dd>
819 <dt><b><tt>exponentialize(a)</tt></b></dt>
820 <dd> Transforms all trigonometric functions
821 in <tt>a</tt> to their complex exponential equivalents.</dd>
822 <dt><b><tt>factor(a)</tt></b></dt>
823 <dd> Factors <tt>a</tt>.</dd>
824 <dt><b><tt>freeof(a,b)</tt></b></dt>
825 <dd> Is true if the variable <tt>a</tt> is not part
826 of the expression <tt>b</tt>.</dd>
827 <dt><b><tt>grind(a)</tt></b></dt>
828 <dd> Displays a variable or function <tt>a</tt> in a
829 compact format. When used with <tt>writefile</tt> and an editor
830 outside of Maxima, it offers a scheme for producing <tt>batch</tt>
831 files which include Maxima-generated expressions.</dd>
832 <dt><b><tt>ident(a)</tt></b></dt>
833 <dd> Returns an <tt>a</tt> × <tt>a</tt>
834 identity matrix.</dd>
835 <dt><b><tt>imagpart(a)</tt></b></dt>
836 <dd> Returns the imaginary part of <tt>a</tt>.</dd>
837 <dt><b><tt>integrate(a,b)</tt></b></dt>
838 <dd> Attempts to find the indefinite integral
839 of <tt>a</tt> with respect to <tt>b</tt>.</dd>
840 <dt><b><tt>integrate(a,b,c,d)</tt></b></dt>
841 <dd> Attempts to find the indefinite
842 integral of <tt>a</tt> with respect to <tt>b</tt>. taken from
843 <tt>b</tt><tt>=</tt><tt>c</tt> to <tt>b</tt><tt>=</tt><tt>d</tt>. The limits of integration <tt>c</tt>
844 and <tt>d</tt> may be taken as <tt>inf</tt> (positive infinity) or <tt>
845 minf</tt> (negative infinity).</dd>
846 <dt><b><tt>invert(a)</tt></b></dt>
847 <dd> Computes the inverse of the square matrix <tt>
849 <dt><b><tt>kill(a)</tt></b></dt>
850 <dd> Removes the variable <tt>a</tt> with all its
851 assignments and properties from the current Maxima environment.</dd>
852 <dt><b><tt>limit(a,b,c)</tt></b></dt>
853 <dd> Gives the limit of expression <tt>a</tt> as
854 variable <tt>b</tt> approaches the value <tt>c</tt>. The latter may be
855 taken as <tt>inf</tt> or <tt>minf</tt> as in <tt>integrate</tt>.</dd>
856 <dt><b><tt>lhs(a)</tt></b></dt>
857 <dd> Gives the left-hand side of the equation <tt>a</tt>.</dd>
858 <dt><b><tt>loadfile(a)</tt></b></dt>
859 <dd> Loads a disk file with filename <tt>a</tt> from
860 the current default directory. The disk file must be in the proper
861 format (i.e. created by a <tt>save</tt> command).</dd>
862 <dt><b><tt>makelist(a,b,c,d)</tt></b></dt>
863 <dd> Creates a list of <tt>a</tt>'s (each of
864 which presumably depends on <tt>b</tt>), concatenated from
865 <tt>b</tt><tt>=</tt><tt>c</tt> to <tt>b</tt><tt>=</tt><tt>d</tt></dd>
866 <dt><b><tt>map(a,b)</tt></b></dt>
867 <dd> Maps the function <tt>a</tt> onto the
868 subexpressions of <tt>b</tt>.</dd>
869 <dt><b><tt>matrix(a1,a2,...,an)</tt></b></dt>
870 <dd> Creates a matrix consisting of the rows <tt>ai</tt>, where each
871 row <tt>ai</tt> is a list of <tt>m</tt> elements, <tt>[b1, b2, ..., bm]</tt>.</dd>
872 <dt><b><tt>num(a)</tt></b></dt>
873 <dd> Gives the numerator of <tt>a</tt>.</dd>
874 <dt><b><tt>ode2(a,b,c)</tt></b></dt>
875 <dd> Attempts to solve the first- or second-order
876 ordinary differential equation <tt>a</tt> for <tt>b</tt> as a function of
878 <dt><b><tt>part(a,b1,b2,...,bn)</tt></b></dt>
879 <dd> First takes the <tt>b1</tt>th part
880 of <tt>a</tt>, then the <tt>b2</tt>th part of that, and so on.</dd>
881 <dt><b><tt>playback(a)</tt></b></dt>
882 <dd> Displays the last <tt>a</tt> (an integer)
883 labels and their associated expressions. If <tt>a</tt> is omitted,
884 all lines are played back. See the Manual for other options.</dd>
885 <dt><b><tt>ratsimp(a)</tt></b></dt>
886 <dd> Simplifies <tt>a</tt> and returns a quotient of
887 two polynomials.</dd>
888 <dt><b><tt>realpart(a)</tt></b></dt>
889 <dd> Returns the real part of <tt>a</tt>.</dd>
890 <dt><b><tt>rhs(a)</tt></b></dt>
891 <dd> Gives the right-hand side of the equation <tt>a</tt>.</dd>
892 <dt><b><tt>save(a,b1,b2,..., bn)</tt></b></dt>
893 <dd> Creates a disk file with
894 filename <tt>a</tt> in the current default directory, of variables,
895 functions, or arrays <tt>bi</tt>. The format of the file permits it to
896 be reloaded into Maxima using the <tt>loadfile</tt> command.
897 Everything (including labels) may be <tt>save</tt>d by taking <tt>b1</tt>
898 equal to <tt>all</tt>.</dd>
899 <dt><b><tt>solve(a,b)</tt></b></dt>
900 <dd> Attempts to solve the algebraic equation <tt>
901 a</tt> for the unknown <tt>b</tt>. A list of solution equations is
902 returned. For brevity, if <tt>a</tt> is an equation of the form
903 <tt>c</tt><tt> = </tt><tt>0</tt>, it may be abbreviated simply by the expression
905 <dt><b><tt>string(a)</tt></b></dt>
906 <dd> Converts <tt>a</tt> to Maxima's linear notation
907 (similar to Fortran's) just as if it had been typed in and puts <tt>
908 a</tt> into the buffer for possible editing. The <tt>string</tt>'ed
909 expression should not be used in a computation.</dd>
910 <dt><b><tt>stringout(a,b1,b2,...,bn)</tt></b></dt>
911 <dd> Creates a disk file with
912 filename <tt>a</tt> in the current default directory, of variables
913 (e.g. labels) <tt>bi</tt>. The file is in a text format and is not
914 reloadable into Maxima. However the strungout expressions can be
915 incorporated into a Fortran, Basic or C program with a minimum of
917 <dt><b><tt>subst(a,b,c)</tt></b></dt>
918 <dd> Substitutes <tt>a</tt> for <tt>b</tt> in <tt>c</tt>.</dd>
919 <dt><b><tt>taylor(a,b,c,d)</tt></b></dt>
920 <dd> Expands <tt>a</tt> in a Taylor series in
921 <tt>b</tt> about <tt>b</tt><tt>=</tt><tt>c</tt>, up to and including the term
922 <tt>(</tt><tt>b</tt>−<tt>c</tt><tt>)</tt><sup><tt>d</tt></sup>. Maxima also supports Taylor expansions in more
923 than one independent variable; see the Manual for details.</dd>
924 <dt><b><tt>transpose(a)</tt></b></dt>
925 <dd> Gives the transpose of the matrix <tt>a</tt>.</dd>
926 <dt><b><tt>trigexpand(a)</tt></b></dt>
927 <dd> Is a trig simplification function which
928 uses the sum-of-angles formulas to simplify the arguments of
929 individual <tt>sin</tt>'s or <tt>cos</tt>'s. For example, <tt>
930 trigexpand(sin(x+y))</tt> gives <tt>cos(x) sin(y) + sin(x) cos(y)</tt>.</dd>
931 <dt><b><tt>trigreduce(a)</tt></b></dt>
932 <dd> Is a trig simplification function which
933 uses trig identities to convert products and powers of <tt>sin</tt> and
934 <tt>cos</tt> into a sum of terms, each of which contains only a single
935 <tt>sin</tt> or <tt>cos</tt>. For example, <tt>trigreduce(sin(x)^2)</tt>
936 gives <tt>(1 - cos(2x))/2</tt>.</dd>
937 <dt><b><tt>trigsimp(a)</tt></b></dt>
938 <dd> Is a trig simplification function which
939 replaces <tt>tan</tt>, <tt>sec</tt>, etc., by their <tt>sin</tt> and <tt>
940 cos</tt> equivalents. It also uses the identity <tt>sin</tt><tt>(</tt><tt>)</tt><sup><tt>2</tt></sup> <tt>+</tt> <tt>cos</tt><tt>(</tt><tt>)</tt><sup><tt>2</tt></sup><tt> = </tt><tt>1</tt>.</dd>
943 <div class="p
"><!----></div>
944 <hr /><h3>Footnotes:</h3>
946 <div class="p
"><!----></div>
947 <a name="tthFtNtAAB
"></a><a href="#tthFrefAAB
"><sup>1</sup></a>Adapted from ``Perturbation Methods, Bifurcation Theory and Computer Algebra''
948 by Rand and Armbruster, Springer, 1987.
949 Adapted to <span class="roman
">L</span><sup><span class="roman
">A</span></sup><span class="roman
">T</span><sub><span class="roman
">E</span></sub><span class="roman
">X</span> and HTML by Nelson L. Dias (nldias@simepar.br),
950 SIMEPAR Technological Institute and Federal University of ParanĂ¡, Brazil.
951 Updated by Robert Dodier, August 2005.
952 <br /><br /><hr /><small>File translated from
953 T<sub><span class="small
">E</span></sub>X
954 by <a href="http://hutchinson.belmont.ma.us/tth/
">
955 T<sub><span class="small
">T</span></sub>H</a>,
956 version 4.03.<br />On 2 Feb 2019, 17:00.</small>