Introduction to Maple
This is a list of instructions mentioned in the MAPLE NEW USER'S
TOUR.
all commands end with a semicolon (;) or a full colon (:) (the latter
supresses the output)
% stands for the output of the previous command
assignment of a value is done with :=
= is used for the equality in an equation, etc.
help(topic);
same as ??topic
restart clear internal memory
Pi the constant 3.1415...
I the imaginary unit, sqrt(-1)
define functions:
f:=x->x^2;
g:=(x,y)-> x+y^3;
p := x -> piecewise( x<0, -1, x>1, 2*x, x^2 );
turn an expression into a function: h := unapply(x^2 + 1/2, x);
ifactor integer factorization
factor
simplify
normal simplify fractions
expand
seq create a sequence
evalf floating point evaluation
e.g.: evalf( sqrt(3));
evalf( % , 50 ); (50 digits)
sum e.g.: sum( (1+i)/(1+i^4), i=1..10 );
sum( 1/k^2, k=1..infinity );
product e.g: product( ((i^2+3*i-11)/(i+3)), i=0..10 );
convert e.g., to polar: evalf( (3+5*I)/(7+4*I) , 50 );
convert( (a*x^2+b)/(x*(-3*x^2-x+4)), parfrac, x );
convert( cot(x), exp );
standard functions, constants: Pi, GAMMA, exp
assigning variable names: e.g.: expr1 := (41*x^2+x+1)^2*(2*x-1);
expr2 := expand(expr1);
equations eqn := x^3-1/2*a*x^2+13/3*x^2 = 13/6*a*x+10/3*x-5/3*a;
solve( eqn, {x} );
eval( eqn , x=1/2*a );
solve( {eqn1, eqn2, eqn3, eqn4}, {a, b, c, d} );
eval( {eqn1, eqn2} , % );
solve( arccos(x) - arctan(x)= 0, {x} );
solve( abs( (z+abs(z+2))^2-1 )^2 = 9, {z});
solve( {x^2<1, y^2<=1, x+y<1/2}, {x,y} );
ineq := x+y+4/(x+y) < 10:
solve( ineq, {x} );
expr := 2*sqrt(-1-I)*sqrt(-1+I):is( expr <> 0 );
graphics display if the plot is produced with "characters",
you can have it displayed in a separate window with
the command
plotsetup(x11);
(for users of Linux/Unix). For other options, see
help(window).
E.g., to save the plot as a Postscript file, use
plotsetup(ps), but you might achieve this also by
"printing" from the plot window.
2D plot( tan(x), x=-2*Pi..2*Pi, y=-4..4, discont=true,
title="y = tan(x)" );
plots package:
implicitplot( { x^2+y^2=1, y=exp(x) }, x=-Pi..Pi,
y=-Pi..Pi, scaling=CONSTRAINED );
plottools package:
c := circle( [0, 0], 1, color=green ):display( c,
scaling=CONSTRAINED, title="Unit Circle" );
3D plot3d( x*exp(-x^2-y^2), x=-2..2, y=-2..2, axes=BOXED,
title="A Surface Plot" );
can rotate the plot using the mouse
p := display( seq( cutout(v, 4/5), v=stellate(dodecahedron(), 3) ),
style=PATCH ):
q := display(cutout(icosahedron([0, 0, 0], 2.2), 7/8) ):
display( p, q, scaling=CONSTRAINED, title="Nested Polyhedra" );
animation (plots package)
animate3d( cos(t*x)*sin(t*y), x=-Pi..Pi, y=-Pi..Pi, t=1..2 );
use Play from Animation menu
inequalities
inequal( { x+y > 0, x-y <= 1, y = 2 }, x=-3..3,
y=-3..3, optionsfeasible=(color=red),
optionsopen=(color=blue, thickness=2),
optionsclosed=(color=green, thickness=3),
optionsexcluded=(color=yellow) );
derivatives diff( f(x), x);
diff( f(x), x, x);
antiderivatives int(f(x), x);
integrals int(f(x), x=1..2);
limits limit( (2*x+3)/(7*x+5), x=infinity );
limit( tan(x+Pi/2), x=0, left );
limit( tan(x+Pi/2), x=0, right );
series approx1 := series( sin(4*x)*cos(x), x=0 );
increase order of the series:
Order := 12;
plot the series truncation and the original:
poly1 := convert( approx1, polynom );
plot( {sin(4*x)*cos(x), poly1}, x=-1..1, y=-2..2, title =
cat( convert(expr, string)," vs. Series
Approximation" ) );
next sections: 7. Differential equations
8. Linear algebra
9. Finance and statistics
10. Programming
11. Online help
12. Summary