Tutorial: Using wxMaxima

advertisement
Tutorial: Using wxMaxima
In this tutorial you will learn how to use wxMaxima, a multi-platform GUI
for Maxima computer algebra system. wxMaxima makes using Maxima much
simpler than using Maxima via commandline, but only if you know your way
around wxMaxima.
1
wxMaxima document
(%i38)
(%o38)
Jp:diff( J,t);
− ddt q2 + ddt q1 cos (q2
+ q1) −
−sin (q1) ddt q1
d
dt
q2 +
d
dt
q1 cos (q2 + q1) − cos (q2)
0
Unlike ’commandline Maxima’, which works in a simple input-output manner,
wxMaxima introduces the concept of a live mathematical document, in which
you mix text, calculations and plots.
Each wxMaxima document consists of a number of so called ’cells’. Cells are
the basic building blocks of a wxMaxima document. Each cell has a bracket
on the left border of the document, indicating where the cell begins and ends.
Cells are of different types. The first cell in this document is a ’title cell’, the
second is a ’text cell’, the third is a ’section cell’ and so on. There is also the
most important cell type: the ’input cell’. Below this cell is an example of input
cell.
-->
/* this is an input cell - it holds Maxima code and can be
evaluated with SHIFT-ENTER. The code entered in this cell
will be sent to Maxima when you press SHIFT-ENTER. Before
wxMaxima sends code to Maxima, it checks if the contents
of an input cell ends with a ’;’ or a ’$’ - if it doesn’t,
wxMaxima adds a ’;’ at the end. Maxima requires that lines
end with either ’;’ or ’$’.
Any output wxMaxima gets from Maxima will be attached into
the output part of the input cell. Try clicking in this cell
and pressing SHIFT-ENTER. */
/*example Maxmima code: */
print("Hello, world!")$
integrate(x^2, x);
1
d
dt
q2
Editing cells is easy - to modify the contents of a cell, click into it. A cursor
should appear and the left cell bracket should turn red, to indicate that the cell
is being edited.
Note however that once you move the cursor past the beginning, a horizontal
line appears between cells. Think of this line as a horizontal cursor. Pressing
any key will insert a new input cell, while pressing SHIFT-UP/DOWN will
select cells in that direction. Activating the horizontal cursor is also possible
by clicking between cells; click-dragging will result in a cell selection. When
you have a selection of cells, pressing backspace or delete key will delete the
selection. You can also cut, copy and paste cells using menu commands in
Edit->Cell submenu. Try deleting, copying and pasting cells in this document.
When the horizontal cursor is active, typing will result in a new input cell. If
you want to insert a cell of some other type, go to Edit->Cell submenu or use the
respective key shortcut. Sometimes a Maxima command result in a very long
output. Evaluate the input cell below (click into it and press SHIFT-ENTER).
-->
expand( (a+b)^40 );
You can hide the ouptut by clicking into the empty triangle at the top of the
bracket of the input cell above. The output can be shown again by clicking
again into the triangle. A full triangle indicates that the cell’s output is hidden.
When you’re satisfied with the document you’ve created, save it using Ctrl-S key
command or File->Save menu command. Note that the output parts of input
cells will not be saved. When you load your document you can evaluate all cells
by Edit->Cell->Evaluate all cells menu command or respective key command.
2
wxMaxima helper dialogs
Some common Maxima commands are available through Maxima, Equations,
Algebra, Calculus, Simplify, Plot and Numeric menus. All menu entries ending
with ’...’ will open a dialog, to help you formulate the command. The resulting
command will be inserted at horizontal cursor’s position or below the currently
active cell. The command will also be evaluated.
An optional button panel at the bottom of wxMaxima window works in a similar
manner. The button panel can be configured through Preferences. Note also
that if you have a selection before you use a button panel command or a menu
command, that selection will be used as the main (or only) argument to the
command. Selection of a previous output or part of an input will work in a
similar manner. Get familiar and experiment with the commands, available
through menus to get a feeling for it. Perhaps you will also get to know new
Maxima functions you didn’t know before.
-->
2
(%o8)
1
(%i20)
Se: [cos(q1+q2)+ cos(q2),
sin(q1)];
(%o20)
[cos (q2 + q1) + cos (q2) , sin (q1)]
(%i22)
J : jacobian(Se,[q1,q2]);
−sin (q2 + q1) −sin (q2 + q1) − sin (q2)
cos (q1)
0
(%o22)
(%i23)
depends ([q1, q2], [t]);
(%o23)
[q1 (t) , q2 (t)]
(%i30)
Jp:diff( J,t);
− ddt q2 + ddt q1 cos (q2
+ q1) −
−sin (q1) ddt q1
(%o30)
d
dt
d
dt
q2 +
q1 cos (q2 + q1) − cos (q2)
0
d
dt
q2
-->
d
d
q2 +
q1
dt
dt
(%o37)
−
(%i32)
JJP:ratsimp(%);
− ddt q2 − ddt q1 cos (q2
+ q1)
−sin (q1) ddt q1
(%o32)
(%i35)
(%o35)
cos (q2 + q1) − cos (q2)
− ddt q2 −
d
q2
dt
d
dt
q1 cos (q2 + q1) − cos (q2)
0
subst(q1p, diff(q1,t), %);
− ddt q2 − q1p cos (q2 + q1) − ddt q2 − q1p cos (q2 + q1) − cos (q2)
−sin (q1) q1p
0
3
d
dt
d
dt
q2
q2
Download