Professional Documents
Culture Documents
Remarks
Maple command lines will be given as lines beginning with the symbol >, e.g.
>
x+y;
x+y
New Maple users sometimes type 2 x, 2x or x2 when they mean multiply 2 and
x together, i.e. 2 x. Spaces between symbols are optional, but Maple requires
* for multiplication, i.e. one types 2*x or x*2.
Round brackets are used to indicate precedence, so 2*(3+5) evaluates to 16. Also,
since the multiplication symbol can not be suppressed, 2(3+5) and 2*(3+5) do
not produce the same Maple output.
Examples
>
(2+3)*7;
35
>
1/35;
1
35
>
1/35.0;
.02857142857
>
>
2^(1/2);
2^(.5);
1.414213562
>
>
a/(b-c);
a
bc
(x+2*y);
x + 2y
The percentage symbol %, known as the ditto operator , is used as a name for
the previous successfully executed result. Maple applies the new command to this
expression. You can also use your mouse to cut and paste and you can go back,
edit a line and then re-execute.
>
%^5;
(x + 2 y)5
The Maple commands such as expand and factor can be used to manipulate
algebraic expressions: expand multiplies out expressions in full and factor finds
the polynomial factors.
>
expand(%);
x5 + 10 x4 y + 40 x3 y 2 + 80 x2 y 3 + 80 x y 4 + 32 y 5
>
factor(%);
(x + 2 y)5
>
20!;
2432902008176640000
>
%/18!;
380
>
y:=t^2-5*t+6;
y := t2 5 t + 6
>
solve(y=0,{t});
{t = 2}, {t = 3}
evalf(4/7);
.5714285714
>
evalf(4/7,20);
.57142857142857142857
>
>
sqrt(3);
evalf(%);
1.732050808
>
y:=2*x-3;
y := 2 x 3
>
y^2+8*y+7;
(2 x 3)2 + 16 x 17
>
expand(%);
4 x2 + 4 x 8
>
factor(%);
4 (x + 2) (x 1)
Getting Help: Maple commands are documented in the online help facility. Spend
some time exploring the help available. Often the most informative section of a help file
is the Examples section which illustrates the use of the command.
Graphics
Maple can help you can visualise mathematics. Frequently one of the best ways of
understanding a mathematical structure is to plot it in an appropriate way. Maple
can produce several forms of plots, many of which we shall meet during this course.
Two of the most versatile commands for plotting mathematical functions are plot, for
two-dimensional functions and plot3d, for three-dimensional functions.
sin(x)
For our first example, we plot f (x) =
for 10 x 10.
x
>
plot(sin(x)/x,x=-10..10);
plot3d(sin(x)*cos(y),x=0..4*Pi,y=0..4*Pi);
Exercises
1. Use Maple to execute the following commands:
>
100!;
>
%/(99!);
>
2/3 + 7/8;
>
(a+b)^10;
>
expand(%);
>
factor(%);
>
expand((x+y)^3)/(x+y);
2. Experiment with Maple using the following commands:
>
restart;
>
x^12;
>
3/11;
>
%^12;
>
y;
>
y := t^2 + 3*t -2;
>
answer := solve(y=0,t);
>
>
>
>
answer[1];
evalf(%);
y := y;
y;
The special numbers 2 and are represented by sqrt(2) and Pi, respectively.
The Maple command pi gives the greek letter rather than the number . This
can be seen by as follows:
>
evalf(pi);
sin(r)
(ii) f (x, y) =
, where r = x2 + y 2 , for 20 x 20 and 20 y 20.
r
Meaning
multiplies all the factors in the expression expr
is used to factor the expression expr
converts the expression expr into rational form
collects all coefficients of powers of x in the expression expr
expresses the expression expr in partial fraction of x
applies a number of simplification rules to the expression expr
gives the numerator of the rational expression expr
gives the denominator of the rational expression expr
Examples
Example 1. Determine the partial fraction decomposition of the function
>
1
.
(x 3)(x 1)
convert(1/((x-3)*(x-1)),parfrac,x);
1 1
1 1
2x3 2x1
f:=(x^2-1)/(x^2-2*x+1)^2;
f :=
>
x2 1
(x2 2x + 1)2
factor(f);
x+1
(x 1)3
>
normal(f);
x+1
(x 1)(x2 2x + 1)
>
simplify(f);
x+1
(x 1)(x2 2x + 1)
x2 1
.
(x2 2x + 1)2
>
convert(f,parfrac,x);
2
1
+
3
(x 1)
(x 1)2
simplify(ln(2**x));
x ln(2)
>
simplify(exp(3*ln(x)));
x3
f = (x + 1)(x + 2),
Collect the coefficients of powers of y in g.
>
f:=(x+1)*(x+2);
f := (x + 1)(x + 2)
>
collect(f,x);
x2 + 3x + 2
>
>
>
g:=(x+4*y)**3+2*x-3*y**2;
g := (x + 4y)3 + 2x 3y 2
collect(g,x);
x3 + 12yx2 + (2 + 48y 2 )x + 64y 3 3y 2
collect(g,y);
64y 3 + (48x 3)y 2 x + 12yx2 + x3 + 2x
x2 + 3x + 2
. Extract the numerator
x2 + 5x + 6
and denominator of y and factor them. Apply the normal command to y and then
extract the numerator and denominator of the resulting expression.
Example 5. Consider the rational function y =
>
y:=(x^2+3*x+2)/(x^2+5*x+6);
y :=
>
x2 + 3x + 2
x2 + 5x + 6
numer(y);
x2 + 3x + 2
>
factor(%);
(x + 1)(x + 2)
>
denom(y);
x2 + 5x + 6
>
factor(%);
(x + 3)(x + 2)
>
z:=normal(y);
z :=
>
x+1
x+3
numer(z);
x+1
>
denom(z);
x+3
Remarks
The normal command is a basic form of simplification. It recognises those expressions equal to zero which lie in the domain of rational functions. This includes
any expression constructed from sums, products and integer powers of integers
and variables. The expression is converted into the form numerator/denominator,
where the numerator and denominator are relatively prime polynomials with integer coefficients.
The simplify command is a more powerful simplification tool which also applies
to more general expressions involving square roots, trigonometric, exponential and
logarithmic functions etc., as well as rational functions.
The exponential function ex or exp(x) is written as exp(x) in Maple. The logarithmic function ln x or log x (assumed to be to base e) is written as ln(x) or
log(x) in Maple.
The procedures numer and denom are typically called after first using the normal
command. The procedure normal is used to put an expression in normal form
which is the form numerator/denominator where both the numerator and denominator are polynomials. In this case, numer simply picks off the numerator of the
expression and denom picks off the denominator of the expression (see Example 5).
Exercises
5. Use Maple help to get more information about the Maple commands expand,
factor, normal, collect, convert, simplify, numer and denom.
6. Write in Maple each of the following expressions
1
5
+ ,
x 2 3x
x2
,
4
x 3x3 + 1
xy+1 ,
ln(x2 + 1),
exy .
x12 1
7. Apply the factor, normal and simplify commands to the expression 4
.
(x 1)2
Express this in partial fractions.
g = (x + 2y + 3z 2 )2 + (x + y 3 )5 .
10. Apply the factor command to x2 + 1. Are you satisfied by the result? Let
x2 4
,
x2 1
x2
4
2
,
2
x 1 x 1
(x 2)(x + 2)(x + 1)
,
x3 + x2 x 1
1 November 2007
x4 + x3 4x2 4x
. Transx4 + x3 x2 x
(x 2)(x + 2)
,
(x 1)(x + 1)
x2
4
(d)
(x 1)(x + 1) (x 1)(x + 1)
x4 + x3 4x2 4x
(f)
x(x 1)(x + 1)2
(b)