File: 10MinuteTutorial.wxm

package info (click to toggle)
wxmaxima 24.02.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 32,708 kB
  • sloc: cpp: 77,136; xml: 10,513; ansic: 3,651; lisp: 1,903; sh: 28; makefile: 15
file content (263 lines) | stat: -rw-r--r-- 7,773 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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
/* [wxMaxima batch file version 1] [ DO NOT EDIT BY HAND! ]*/
/* [ Created with wxMaxima version 23.03.0-DevelopmentSnapshot ] */
/* [wxMaxima: title   start ]
10 minute (wx)Maxima tutorial
   [wxMaxima: title   end   ] */


/* [wxMaxima: comment start ]
Welcome to wxMaxima! In this introductory tutorial you will
learn the basics of wxMaxima and Maxima. Maxima is a CAS
(Computer Algebra System) similar to systems like Mathematica,
Maple and others. Maxima, however, is a commandline application,
which makes it a bit harder to use than its younger cousins.
Here is where wxMaxima comes in - it's a GUI (Graphical User
Interface) for Maxima, made to make using Maxima simpler and
more enjoyable.

Let's start with some simple calculation examples! Below is 
an input cell with a simple addition. Place the cursor in it
and press SHIFT-ENTER to evaluate it.
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
1 + 1;
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
If you didn't get any errors, your Maxima is configured properly.
If you did get an error, you should check wxMaxima configuration or
visit wxMaxima website (https://wxmaxima-developers.github.io/wxmaxima/) for
instructions on how to setup wxMaxima and Maxima properly!

Assuming you've delt with your problems, let's do some more
calculations (again - place the cursor in the input cell below
and press SHIFT-ENTER to evaluate the code)!
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
5!;
% * 10;
%o1 * 100;
1 / 3;
1.0 / 3.0;
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
In the input cell above, we've sent 5 "lines" to Maxima. Each line
must end with a ";" or a "$". In case the line ends with a ";", Maxima
will show the result of the line, while results of lines ending
with "$" will be suppressed. The "$" comes in handy when doing longer
calculations. Note also that the result of "1/3" and "1.0/3.0" differ.
That's because Maxima, unlike numerical matrix packages (Matlab etc.),
tries to keep calculations precise - it does not evaluate 
expressions like 1/3 or sqrt(2) unless asked to. In "1.0/3.0" we used
floating point numbers, so Maxima didn't leave expression unevaluated.

We can, however, tell Maxima we want a floating point approximation
of an expression. Evaluate the cell below and observe results.
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
sqrt(2 * %pi);
float(%);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
In line "float(%);" we used the "%" symbol. This symbol always holds
the result of the last evaluated line. Numbered symbols "%o1", "%o2"
... hold the results as they appear when input cells are evaluated.
We can also store, not only numbers, but whole expressions, in variables.
Use "variable_name: value;" form to store value into "variable_name".
Evaluate the cell below and observe.
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
radius: 10 $
height: 100 $
area: %pi * radius^2;
volume: area * height;
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
Let's evaluate the last result numerically:
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
float(%);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
So far we've only used Maxima as a simple calculator. Now let's try
some things not possible with a calculator. Indefinite and definite
integrals:
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
integrate( sin(x), x);
integrate( sin(x), x, 0, %pi);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
Let's define a function, evaluate it and integrate it!
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
f(x) := x^2 + a$
f(5);
f(5), a = -5;
integrate( f(var), var );
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
Sometimes Maxima needs additional information to evaluate an expression
and asks us a question. A cursor should appear automatically, indicating
you need to answer a question. If it doesn't, write an answer below the
cell and send it to Maxima with SHIFT-ENTER. Note: instead of answering
with "positive;", you can only type "p". Below is an integral with
a question:
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
integrate( 1 / (x^2 + a), x);
/* [wxMaxima: input   end   ] */
/* [wxMaxima: question  start ] */
<math><mrow lisp="mtext"><mrow lisp="mtext"><st>Is </st><mi>a</mi><st> positive or negative?</st></mrow></mrow></math>
/* [wxMaxima: question  end   ] */
/* [wxMaxima: answer  start ] */
p;
/* [wxMaxima: answer  end   ] */
/* [wxMaxima: question  start ] */
<math><st>Is </st><mi lisp="*var-tag*">a</mi><st> positive or negative?</st></math>
/* [wxMaxima: question  end   ] */
/* [wxMaxima: answer  start ] */
p;
/* [wxMaxima: answer  end   ] */
/* [wxMaxima: question  start ] */
<math><st>Is </st><mi>a</mi><st> positive or negative?</st></math>
/* [wxMaxima: question  end   ] */
/* [wxMaxima: answer  start ] */
p;
/* [wxMaxima: answer  end   ] */
/* [wxMaxima: autoanswer    ] */

/* [wxMaxima: comment start ]
We can also inform Maxima beforehand using the function "assume". To
revert an assumption, use "forget".
(Note: to get help on any function, just click on the function name
and press F1. Try it.)
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
assume(a > 0)$
integrate( 1 / (x^2 + a), x);
forget(a > 0)$
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
Now that you've learned the basics, it's time for some general
mathematical examples! Remember: if you want to know more about
a specific function, click on it and press F1.

Solving equations using solve:
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
solve(a*x^2 + b*x + c = 0, x);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
Linear algebra. Use "matrix" to create matrices. Matrices can contain
non-number expressions. Use "invert" to calculate an inverse and "."
for matrix multiplication.
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
A: matrix([1,-1],
          [1,sin(c)]);
B: invert(A);

A.B;
ratsimp(A.B);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
In the last line we used "ratsimp" to simplify the result of "A.B".
Maxima has a lot of different simplification functions, depending on
what kind of simplification you want. Simplification is a complex
topic and if you don't know anything about it, using "ratsimp" may
be your best shot.

Let's do a 2D and a 3D plot!
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
wxplot2d([sin(x), cos(x)], [x,0, 2*%pi]);
wxplot3d( exp(-x^2 - y^2), [x,-2,2],[y,-2,2]);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
Let's try differenciation using "diff" function.
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
f(x) := x^2 $
diff(f(x), x);
g(y) := sin(y)$
g(f(x));
diff( g(f(x)) , x);
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
Yes, Maxima knows about the chain rule!

And for the end, let's solve an ODE of second order:
y''(t) + omega^2 * y(t) = 0
   [wxMaxima: comment end   ] */


/* [wxMaxima: input   start ] */
assume(omega > 0);
ode2( 'diff(y, t, 2) + omega^2 * y = 0, y, t );

ic2(%, t = 0, y = amp, 'diff(y,t) = 0 );
/* [wxMaxima: input   end   ] */


/* [wxMaxima: comment start ]
You should now start exploring (wx)Maxima on your own. Remember 
to press F1 often, if you want Maxima to help you solve your 
mathematical problems!

Enjoy using Maxima and wxMaxima!
   [wxMaxima: comment end   ] */



/* Old versions of Maxima abort on loading files that end in a comment. */
"Created with wxMaxima 23.03.0-DevelopmentSnapshot"$