MAXIMA_10_min_EN.pdf

(223 KB) Pobierz
677783919 UNPDF
A 10 minute tutorial for solving Math
About 50,000 people read my article 3 awesome free Math programs . Chances are that at least some
of them downloaded and installed Maxima. If you are one of them but are not acquainted with CAS
(Computer Algebra System) software, Maxima may appear very complicated and difficult to use,
even for the resolution of simple high school or calculus problems. This doesn’t have to be the case
though, Maxima is very friendly and this 10 minute tutorial will get you started right away. Once
you’ve got the first steps down, you can always look up the specific function that you need, or learn
more from Maxima’s official manual . Alternatively, you can use the question mark followed by a
string to obtain in-line documentation (e.g. ? integrate). This tutorial takes a practical approach,
where simple examples are given to show you how to compute common tasks. Of course this is just
the tip of the iceberg. Maxima is so much more than this, but scratching even just the surface should
be enough to get you going. In the end you are only investing 10 minutes.
Maxima as a calculator
You can use Maxima as a fast and reliable calculator whose precision is arbitrary within the limits
of your PC’s hardware. Maxima expects you to enter one or more commands and expressions
separated by a semicolon character (;), just like you would do in many programming languages.
(%i1) 9+7;
(%o1)
(%i2) -17*19;
(%o2)
(%i3) 10/2;
(%o3)
Maxima allows you to refer to the latest result through the % character, and to any previous input or
output by its respective prompted %i (input) or %o (output). For example:
(%i4) % - 10;
(%o4)
(%i5) %o1 * 3;
(%o5)
For the sake of simplicity, from now on we will omit the numbered input and output prompts
produced by Maxima’s console, and indicate the output with a => sign. When the numerator and
denominator are both integers, a reduced fraction or an integer value is returned. These can be
evaluated in floating point by using the float function (or bfloat for big floating point numbers):
8/2;
=>
8/2.0;
=>
2/6;
=>
677783919.029.png 677783919.030.png 677783919.031.png
float(1/3);
=>
1/3.0;
=>
26/4;
=>
float(26/4);
=>
As mentioned above, big numbers are not an issue:
13^26;
=>
13.0^26
=>
30!;
=>
float((7/3)^35);
=>
Constants and common functions
Here is a list of common constants in Maxima, which you should be aware of:
%e - Euler’s Number
%pi -
%phi - the golden mean (
)
%i - the imaginary unit ( )
inf - real positive infinity ( )
minf - real minus infinity ( )
infinity - complex infinity
We can use some of these along with common functions:
sin(%pi/2) + cos(%pi/3);
=>
tan(%pi/3) * cot(%pi/3);
=>
float(sec(%pi/3) + csc(%pi/3));
=>
sqrt(81);
=>
log(%e);
=>
Defining functions and variables
Variables can be assigned through a colon ‘:’ and functions through ‘:=’. The following code shows
how to use them:
a:7; b:8;
=>
=>
sqrt(a^2+b^2);
=>
f(x):= x^2 -x + 1;
=>
677783919.032.png 677783919.001.png 677783919.002.png 677783919.003.png 677783919.004.png 677783919.005.png 677783919.006.png 677783919.007.png 677783919.008.png 677783919.009.png 677783919.010.png 677783919.011.png 677783919.012.png
f(3);
=>
f(a);
=>
f(b);
=>
Please note that Maxima only offers the natural logarithm function log . log10 is not available by
default but you can define it yourself as shown below:
log10(x):= log(x)/log(10);
=>
log10(10)
=>
Symbolic Calculations
factor enables us to find the prime factorization of a number:
factor(30!);
=>
We can also factor polynomials:
factor(x^2 + x -6);
=>
And expand them:
expand((x+3)^4);
=>
Simplify rational expressions:
ratsimp((x^2-1)/(x+1));
=>
And simplify trigonometric expressions:
trigsimp(2*cos(x)^2 + sin(x)^2);
=>
Similarly, we can expand trigonometric expressions:
trigexpand(sin(2*x)+cos(2*x));
=>
Please note that Maxima won’t accept 2x as a product, it requires you to explicitly specify 2*x. If
you wish to obtain the TeX representation of a given expression, you can use the tex function:
tex(%);
=> $$-\sin ^2x+2\,\cos x\,\sin x+\cos ^2x$$
Solving Equations and Systems
We can easily solve equations and systems of equations through the function solve :
solve(x^2-4,x);
=>
677783919.013.png 677783919.014.png 677783919.015.png 677783919.016.png 677783919.017.png 677783919.018.png 677783919.019.png 677783919.020.png
%[2]
=>
solve(x^3=1,x);
=>
trigsimp(solve([cos(x)^2-x=2-sin(x)^2], [x]));
=>
solve([x - 2*y = 14, x + 3*y = 9],[x,y]);
=>
2D and 3D Plotting
Maxima enables us to plot 2D and 3D graphics, and even multiple functions in the same chart. The
functions plot2d and plot3d are quite straightforward as you can see below. The second (and in the
case of plot3d, the third) parameter, is just the range of values for x (and y) that define what portion
of the chart gets plotted.
plot2d(x^2-x+3,[x,-10,10]);
plot2d([x^2, x^3, x^4 -x +1] ,[x,-10,10]);
677783919.021.png 677783919.022.png 677783919.023.png 677783919.024.png 677783919.025.png
f(x,y):= sin(x) + cos(y);
plot3d(f(x,y), [x,-5,5], [y,-5,5]);
Limits
limit((1+1/x)^x,x,inf);
=> %
limit(sin(x)/x,x,0);
=>
limit(2*(x^2-4)/(x-2),x,2);
=>
limit(log(x),x,0,plus);
=>
limit(sqrt(-x)/x,x,0,minus);
=>
677783919.026.png 677783919.027.png 677783919.028.png
Zgłoś jeśli naruszono regulamin