File: intro.html

package info (click to toggle)
maxima 5.6-17
  • links: PTS
  • area: main
  • in suites: woody
  • size: 30,572 kB
  • ctags: 47,715
  • sloc: ansic: 154,079; lisp: 147,553; asm: 45,843; tcl: 16,744; sh: 11,057; makefile: 7,198; perl: 1,842; sed: 334; fortran: 24; awk: 5
file content (189 lines) | stat: -rw-r--r-- 7,186 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<html>
<br>

<img src=maxima.gif align=center border=0>
<br>


                 <h4 align=center>Maxima Primer</h4>

<body  BGCOLOR=#ffffff TEXT=#000000 LINK=#244C21>



<p>Maxima is a computer program for doing mathematics calculations,
symbolic manipulations, numerical computations and graphics.
Procedures can be programmed and then run by Maxima to
do complex tasks.  Much of the syntax for other languages such as
Maple was copied from Maxima.   Full
<a href=http://www.ma.utexas.edu/maxima/>
documentation </a>is available.

<p>To do basic operations, a line is typed, followed by a
semicolon, and then entered.  This can be done in the window above.
Alternately you may edit the blue portions in this buffer, and click
on them, to see the result evaluated above and/or inserted in
this window, depending on what was specified in the html source for this
file.  
For example clicking below
<br>
<ul><li>
<eval program=maxima doinsert=0
>integrate(1/(1+x^3),x)</eval> 
</ul>
You may double click the above formula, and the integral will be substituted into the Maxima evaluation in the other window.

There are <a href="doc/examples.html">examples</a> which you may also look at
<a href="doc/plotmaxima.html">3d plotting </a>
If you wish to have your plots appear in a separate window, go to the 
preferences button under file, and select separate.
You may also go to the <http://www.ma.utexas.edu/users/wfs/netmath/netmath.html>
netmath page </a> to see some more capabilities.


<p>Here are some examples from basic calculus.  To have Maxima
evaluate the derivative of the function below, click on this line.
<ul><li>
<eval program=maxima doinsert=1> diff(cos(x),x);</eval> returns <result modified>RESULT</result>.
</ul>

<p>Maxima can calculate <b>indefinite integrals</b>.
<ul>
<li><eval program=maxima doinsert=1> integrate( x/(1+x^3),x );</eval> returns <result modified>RESULT</result>  

<li>...and definite integrals with respect to x from 0 to 1.
<br><eval program=maxima doinsert=1> integrate( 1/(1+x^2), x,  0, 1 ); </eval> returns <result modified>RESULT</result>
<li><eval program=maxima doinsert=0> plot2d(sin(x),[x,0,2*%Pi])</eval>
<li><eval program=maxima doinsert=0> plot3d(x^2-y^2,[x,-2,2],[y,-2,2],[grid,12,12])</eval>
</ul>
<ul>
<li>Also, limits can be evaluated as x goes to infinity:
<br><eval program=maxima doinsert=1> limit( (2*x+1)/(3*x+2),  x,inf );</eval> produces <result modified>RESULT</result> 

<li><eval program=maxima doinsert=1> limit( sin(3*x)/x,  x,0);</eval> evaluates to <result modified>RESULT</result> 
</ul>

<p>Maxima can perform calculations to arbitrary precision.  The
following example computes Pi to one hundred decimal places.
<ul><li><eval program=maxima doinsert=1>block([FPPREC:100],bfloat(%pi))</eval> yields <result modified>RESULT</result> 
if we took sin of this we would get 0 to to within 100 decimal places..
<li><eval program=maxima doinsert=1>block([FPPREC:100],sin(bfloat(%pi)))</eval> gives <result modified>RESULT</result> 

<p>Maxima can solve equations.  Click this line to solve the system.
<li><eval program=maxima doinsert=1> solve([x+y+z=5,3*x-5*y=10,y+2*z=3],[x,y,z]);</eval> returns <result modified>RESULT</result>  

<li><eval program=maxima doinsert=1> solve(x^2-5*x+6 =0,x);</eval> produces <result modified>RESULT</result> 
</ul>
<h5>Linear Algebra</h5>
<p>
For example, matrices can be
entered and manipulated.  Click these two lines.
<ul>
<li><eval program=maxima doinsert=1> A:matrix([1,2],[3,4]);</eval> gives <result modified>RESULT</result> 


<li><eval program=maxima doinsert=1> B:matrix([1,1],[1,1]);</eval> gives <result modified>RESULT</result> 

<p>The matrices can then be added, for example:
<li><eval program=maxima doinsert=1>  A + B ;</eval> returns the sum <result modified>RESULT</result>   

...and multiplied.
<li><eval program=maxima doinsert=1>  A . B ;</eval> gives the product<result modified>RESULT</result>   


<li><eval program=maxima doinsert=1>  A^^-1</eval> evaluates to the inverse: <result modified>RESULT</result>   

<li><eval program=maxima doinsert=1>determinant(matrix([a,b],[c,d]))</eval> gives <result modified>RESULT</result> 
<li><eval program=maxima doinsert=0
>      Fib[0] : 0;
       Fib[1] : 1;
       Fib[n] := Fib[n-1] + Fib[n-2];
</eval>
</ul>
Then the procedure can be called. <eval program=maxima doinsert=1> fib[8];</eval> gives <result>21</result> 


<p>Maxima can solve ODEs analytically and numerically.  Click the
following line for an example of an analytic solution.

    
<ul><li>
<eval program=maxima doinsert=1>ode2('diff(y,x)+3*x*y = sin(x)/x,  y,x)</eval> returns <result modified>Result</result>
<li><eval program=maxima doinsert=1>ode2('diff(y,x) -y = 1, y,x)</eval> returns <result modified>result</result>
<li>
<eval program=maxima doinsert=1> ode2('diff(y,x,2) - y = 1, y,x)</eval> gives <result modified>RESULT</result>  
</ul>

<h4 align=left>Defining a Function</h4>


  <p>The standard form is 

<ul>    
<li>
<eval program=maxima doinsert=1>f(3)</eval> gives <result>F(3)</result>

<li>
<eval program=maxima doinsert=0>f(x):=x+2</eval>
<li>now     <eval program=maxima doinsert=1>f(3)</eval> gives <result>5</result> 
</ul>
<p>Local variables:

  <p>The <!--it>block  construct lets us introduce local variables, and also lets
us have a sequence of statements:

    <pre>block([v1:val1,v2:val2,v3,v4:val4],stmt1,stmt2,... stmtn)</pre>
the value is the value of the last statement.   During the execution the 
variables v1,v2,... will have the values indicated.   If no value is given
for v3 then it will just evaluate to itself:

<p>Thus if we set v3 globally to be 7,
<ul><li><eval program=maxima doinsert=1>v3:7</eval> produces <result>7</result>
<li> , then <eval program=maxima doinsert=1>block([v3],v3)</eval> gives <result>V3</result>.
 </ul>
An example in a function:

<ul>   
<li><eval program=maxima doinsert=0>g(x):=block([u:x+3,w], u:u^2, w:(y+2)^2, u+w);</eval>

  

<li><eval program=maxima doinsert=1>g(2)</eval> yields <result>
                                        2
                                 (Y + 2)  + 25
</result> 
Using If:

   

<li><eval program=maxima doinsert=0>h(x):=block([u:x+3,w], u:u^2, 
              if (u&lt;3) then  w:(y+2)^2 else w:(Y+2)^2+1,
              u+w);
</eval>

   

<li><eval program=maxima doinsert=1>[h(3),h(2)]</eval> gives <result>
                                2              2
                        [(Y + 2)  + 37, (Y + 2)  + 26]
</result> 

  </ul>
Using for:

   
<ul>
<li><eval program=maxima doinsert=1> block([w:0], for i:1 thru 10 do (w:w+i^2))</eval> gives <result>DONE</result> 
</ul>
<p>a for loop always returns 'done as its value.  To get the value you want
add the w.

   
<ul>
<li><eval program=maxima doinsert=1> block([w:0], for i:1 thru 10 do (w:w+i^2),w)</eval> gives <result>385</result> 
</ul>

<p>Information on maxima can be obtained by using <a href="http://www.ma.utexas.edu/cgi-bin/info2www?(maxima)">info </a> via the web.
Alternately <b>describe</b>, for example to get all documentation on functions
whose names include "log" do 
  <br><eval program=maxima doinsert=1>describe("log");all</eval> gives <result modified>RESULT</result>