Maple command summary
Please
e-mail me if you have any useful suggestions about this page.
All Maple commands must end with a semi-colon ;
To define a variable, use :=.
The lone = sets up an equation, it does not define the variable.
Maple may be used to do aritmetic computations.
For example, 2+3; 17-8; 2*5; 1001/13; 2^20;
The evalf command will numerically evaluate an expression (it gives a floating point evaluation)
evalf(Pi);
3.141592654
evalf(sqrt(2));
1.414213562
evalf(exp(1));
2.718281828
Manipulating algebraic expressions
The expand command may be used to expand an algebraic expression.
For example,
expand((x+2)^3);
x3+6x2+12x+8
The simplify command may be used to simplify complicated expressions.
The subs commands may be used to make a substitution,
f=x^3+2*x + 7;
subs( x=x^2, f);
x6 + 2x2 + 7
subs( x=1, f);
10
Graphs
The plot command may be used to plot simple graphs,
plot( x^3, x=-3..3);
plot( 1/x, x=-2..3, y=-5..5);
f:=x-x^3; g=sin(x); plot({f,g},x=-1..1);
f:=x-x^3; g=sin(x); plot([f,g],x=-1..1,color=[red,blue]);
(you won't generally have to worry about making graphs different colors)
To plot parametric equations, place the parametrizations and the limits on the parameter inside []:
plot( [cos(t),sin(t),t=0..2*Pi]);
Equations
The solve command may be used to solve equations,
solve( 3*x+y=9, y);
3x+9
solve( x^2 + x -6 =0, x);
-3, 2
solve( { x+y=2, 2*x+y=3},{x,y});
{x=1,y=1}
The results of these Maple evaluations may be used in later calculations
sol:=solve( x^2 + x -6 =0, x);
sol:=-3, 2
subs( x=sol[1], 2*x+1);
-5
plugs the first solution (x=-3) into the expression 2x+1 and returns the value produced. (2(-3)+1=-5)
The fsolve command may be used to numerically determine real solutions to equations,
fsolve( cos(x)=x,x);
.7390851332
fsolve( x^3-3*x+1=0,x);
-1.879385242, .3472963553, 1.532088886
functions
The trigonometric funcstions are defined in Maple by
sin(x), cos(x), tan(x), cot(x), sec(x),csc(x)
The exponential function ex is given by exp(x)
The natural logarithm is given by log(x)
The absolute value function is given by abs(x)
vectors:
We may define a vector by
v:=[3,4];
If we wish to find the magnitude of the vector, we must load the Maple linalg package.
with(linalg):
and use the command
mag:=norm(v,2);
mag:=5
The direction vector is given by a parallel unit vector v/||v||;
dir:= v/mag;
dir:=[3/5,4/5]
To bypass the linalg package, you may simply compute the magnitude by
finding the square root of the sum of the squares of the components;
mag1:= sqrt( v[1]^2+v[2]^2);
mag1:= 5
Those of you who enjoy digging more deeply into Maple could also try creating your own Maple function to compute the size of a vector;
siz:= v -> sqrt(v[1]^2+v[2]^2);
siz(v);
5
Help:
Maple help for functions may be called by type a ? followed by the command. For example,
?plot;
?log;
?solve;
?subs;
parentheses, braces and brackets
Braces (curly braces), {}, are used to make lists (or sets) of elements in Maple.
The order of the terms is irrelevant, Maple will reorder according to its own "whims" and remove redundant elements. For example,
{1,5,3,3,2};
{1,2,3,5}
{x^2,sin(x),x,cos(x)};
{x,sin(x),cos(x),x^2}
Brackets (square brackets), [],
are used to make Ordered lists. Maple will keep elements in the same order that you listed them. This is very useful for describing points (ordered pairs) and vectors and subscripts in a list.
[1,5,3,3,2];
[1,5,3,3,2]
[x^2,sin(x),x,cos(x)];
[x^2,sin(x),x,cos(x)]
fn:=[x^2,sin(x),x,cos(x)];
fn:=[x^2,sin(x),x,cos(x)]
fn[1];
x2
fn[4];
cos(x)
parentheses, (),are used by Maple to enclose a sequence of expressions to be evaluated in a function.
f:=(x,y)->x^2+y^2;
f(3,4);
25
f(1,10);
101
Go to