wxMaxima Introduction What is wxMaxima? wxMaxima is a

advertisement
wxMaxima Introduction
What is wxMaxima?
wxMaxima is a computer algebra system (CAS). Imagine a calculator which understands not
only numbers but variables as well. Maxima can do virtually all of the mathematics you have
learned up to now – FOILing, simplifying, rationalizing, solving, graphing, functions, fractions,
trig, derivatives, integrals, etc. It can also do a great deal of the math you will learn in the next
couple years. It will do it quickly, it will (usually) do it correctly, but it will only work if you
know exactly how to use it.
So a brief Tutorial of how Maxima works:
1) Open up wxMaxima. You should see a big blank screen and maybe some buttons somewhere
(if you don’t see the buttons labeled “simplify” and such, go to Maxima > Panes > General
Math).
2) Type in a basic arithmetic problem using +, - , *, / and whatever numbers you want and press
shift+enter.
3) Notice two things: (1) You need to use shift+enter to get the line of code to run. (2)
Maxima automatically added a ; to the end of your line. The semi-colon is important from a
coding standpoint, and it’s good practice to ensure that it ends all of the operations you want
Maxima to do (although not strictly necessary).
4) Maxima deals with variables, too. This time, type in: “x+x;” then shift+enter.
5) Now try “x+3x;”
6) Oops. What happened? We humans understand what we meant, but Maxima doesn’t
recognize “3x” as a number or a variable. Edit the line you just wrote (you don’t need a new
line) so that it reads: “x+3*x;” and press shift+enter.
7) Please note that every multiplication operation should use the *. Also, variables need not be a
single letter. You can add “apple+apple”. Variables are case-sensitive, however, so check
your capitalization.
8) On the subject of making an error: You will make them. Don’t panic. In the event that you
inadvertently send your computer into an infinitely repeating loop of calculations (entirely
possible with this sort of software), notice the stop-sign-shaped Interrupt button on the toolbar.
9) Maxima understands order of operations to a fault. Suppose we want:
If you type in “x+2/x+4;” what do you get?
How do you fix it?
10) Exponents are straightforward. Try one. Ex: “3^2;”
11) Squareroots are also simple. The notation is “sqrt(4);”
12) There is only one type of logarithm in Maxima, the log base e (aka natural log, ln). Try one.
Ex: “log(5);”
13) Hm. Unless you were quite lucky or ingenious, you probably didn’t get much information
out of that last line. You’ll notice that log(5) returns log(5). Maxima will always try to return an
exact answer. What if we want a decimal? Right-click the output line - the part that looks like
(%o#)where # is some number – and choose “To Float”. (Simply put, a “float” is a computer
term for a decimal).
14) As an alternative, try “log(5.0);”. Note that using a decimal in your input will return a
decimal.
15) What if you want pi or e? The notation is simple: “%pi” and “%e” respectively.
16) If you want , there are two ways to do it: type “%e^3” or type “exp(3)”. exp is the
standard code for the exponential function base e.
17) Similarly, Maxima does trig. Try “sin(%pi/3);”. Make sure you know how to get a
decimal answer.
18) Maxima factors. Type (or copy-paste) “x^2+34*x+189;” and hit shift+enter. Now press
the factor button. Notice that Maxima automatically wrote “factor(%);” The “%” stands for
whatever is on the previous output line.
19) Now that you have a nice factored form, press the expand button. Maxima should FOIL and
bring us back to our original expression.
20) Similarly, the simplify button calls the ratsimp command, which rationalizes and simplifies
an expression to its simplest form. Try “ratsimp(27/sqrt(3));”
21) Press the “solve...” button. Type in an equation (like “x^2+34*x+189=0” involving the
variable x and leave the “variable(s)” field as x. Hit “ok” and Maxima should solve the equation
for you.
22) Solve the following system of equations using the solve button:
Press the solve button, type both equations into the field separated by a comma, and use both
variables in the “variable(s)” field.
23) What if you want to set and save a particular constant or function? Suppose we want to set
the letter c as a constant value 6. Type “c:6;” and hit shift+enter. You’ve just saved the letter
“c” as 6. Test it. Try “c;”. Now try “c+3;”. From now on, anytime you use “c”, Maxima will
read it as 6.
24) Saving a function is very similar. We’ll make the function
. Type
“f(x):=4*x+1;” and hit shift+enter. Now the function is saved. Try “f(0);” and
“f(2);” and “f(c);”
25) What if I want to make “c” and “f” variables again? You’ll need to clear Maxima’s
memory. On the menu, go to Maxima > Clear Memory. This calls the “kill(all)” command.
26) Maxima can graph. Click the “Plot 2d...” button. Input x^2 as the expression. Keep the x
range between -5 and 5, and adjust the y range between -1 and 25. Ignore the rest of the fields.
Hit “ok”.
Note: If you do not adjust the y range, then Maxima will automatically choose a scale for you.
This can often be helpful.
27) Maxima should have written something that looks like:
“wxplot2d([x^2], [x,-5,5], [y,-1,25])$”
You can do a few things from here. Without having to use the plot button again, you can adjust
the window by changing the x and y limits (be careful – the order matters; the number on the left
must be smaller than the number on the right). You can also enlarge the graph and use your
mouse to approximate points by deleting the “wx” in front. Try it (it should look like
“plot2d([x^2], [x,-5,5], [y,-1,25])$”).
Please note: If you enlarge the graph, you can’t do anything else in the main window until you
close the graph!
28) You can plot multiple graphs at once, just separate each expression by a comma in the Plot
2d window.
29) Maxima differentiates. Define the function “f(x):=x^2+4*x+6;” and press shift+enter.
Now press the “diff...” button (or find “Differentiate...” in the calculus menu). Type in “f(x)”
for the expression. We want to differentiate once with respect to x, so leave the remaining fields
alone and hit ok.
30) Finally, Maxima integrates. Press the “integrate...” button (or find it in the calculus menu).
Again, use “f(x)” for the expression. Notice you can check the “definite integration” box and
define the upper and lower limits if you wish. In this case, however, let’s just do the indefinite
integral, so hit ok.
Note: Maxima does not include the “+C” typically required.
Download