Due Thursday, February 3, 11:59 P.M.
- Overview
- Practicing Maple Commands
- Assignment
This lab will introduce you to using Maple's symbolic mathematics
capability interactively. Maple's numerical mathematics and programming
features will not be covered, since there are other software packages and
programming languages (namely Matlab and Fortran) better suited to these
purposes. After finishing this lab, you should be able to use Maple to
automate many of the algebraic computations needed for differential and
integral calculus, matrix algebra, and ordinary differential equations.
Top
- Maple has a console interface and a worksheet interface. The console
interface is useful when you need to login remotely and use Maple from home;
the worksheet interface is more user friendly and has prettier graphics.
To start the worksheet under Windows, click on the "Math Applications"
folder on the desktop, then click on "Maple 9.5". To use maple in Linux,
you will need to edit your startup shell script (.zprofile unless you've
changed your shell), so that your PATH variable contains directory
/usr/maple/bin and your MANPATH variable contains the
directory /usr/maple/man.
- Most Maple commands require you to place a semicolon at the end
of the command before pressing enter. Alternately, you can terminate
commands with a colon to suppress output.
sin(Pi/2);
sin(Pi/2):
- Maple recognizes many common functions; to get a complete list type
?inifcns
- To get help on any particular feature of Maple, type ? followed by the
topic you want help on:
?exp
When using the worksheet interface, you can also access a help menu via the GUI,
which allows fulltext searches and interactive browsing of all help topics in
hypertext format.
- Another feature of the worksheet interface is text mode, which allows you
to enter comments into a worksheet. You can enter text mode by clicking the
"T" icon at the top of the screen and return to command mode by clicking
the "[>" icon.
- You can assign a value to a variable in Maple using the := operator.
Note that undefined variables are handled symbolically.
z^2;
z := 4;
z^2;
- You can make a variable undefined again using the unassign command:
unassign('z');
z^2;
-
You can always obtain the result of the last command typed into maple using the
builtin variable %:
%^2+%+1;
- Variables can also hold other types of objects such as equations, systems of
equations, matrices, lists of values, etcetera:
p := x^2+2*x+1;
subs(x=4,p);
M := matrix(2,2,[a,b,c,d]);
with(linalg);
det(M);
simul := { a*x+b*y=4, c*x+d*y=8 };
vars := { x, y }
solve(simul,vars);
a := 1; b := 2; c := 3; d := 4;
solve(simul);
Note that some features of Maple are available only if you include the appropriate
package using the with command. The help text for each feature will indicate
whether this is necessary in the examples section.
- Functions can be defined and evaluated in Maple as follows:
f := x -> sin(x)^2+cos(x)^2;
f(0);
f(Pi);
f(rand());
evalf(%);
By default, Maple gives a numerical answer for a computation only when
an exact answer can be provided. The evalf command tells Maple
to display a numerical value even if it has to approximate the result.
- Functions and equations can be plotted in Maple using the plot command
as follows:
g := x -> x^3-12*x^2+47*x-60;
plot(g);
plot(g,0..8);
h := x^2-4*x+3;
plot(h,x);
plot(h,x=1..3);
Note that plotting equations requires you to specify the independent variable.
- If you want to unassign all variables and clear any packages you have enabled,
use the restart command:
restart;
- Try out the remaining commands, making sure you understand what each command
does before continuing. Remember that Maple provides detailed descriptions of each
command via ? if the command's purpose isn't apparent from the output.
f := x -> x^2+2*x+1;
f(3);
p := (x+1)^2;
expand(p);
g := unapply(p,x);
g(3);
testeq(f(x),g(x));
solve({x^2+y^2=1,x+y=1});
q := 1;
for i from 1 to 111 by 10 do q := q*(x-i); end do;
q := expand(q);
plot3d(abs(1/((x+I*y)^9-1)),x=-1.25..1.25,y=-1.25..1.25);
dsolve({diff(y(x),x)=y(x),y(0)=1});
1/infinity;
infinity*infinity;
infinity*0;
1/0.0;
integrate(sin(x),x=0..Pi);
integrate(sin(x),x);
diff(%,x);
convert(32,temperature,Fahrenheit,Celsius);
1/(x-3)+5/(x-2)+10/(x-2)^2;
simplify(%);
numer(%)/expand(denom(%));
convert(%,parfrac,x);
lprint(%);
convert(cot(x)+tan(x)+sec(x)+csc(x),sincos);
convert(371,units,kWh,J);
factor(x^2+7*x+12);
factor(x^9-1);
factor(x^9-1,complex);
factor(12);
ifactor(12);
Top
Complete the following tasks in a single Maple worksheet. When you are done,
save your worksheet, upload it to one of the UNIX machines if necessary, and submit
using the ~gbutler/bin/m171_submit command.
- Enter text mode at the top of the worksheet. On separate lines,
enter your name, the lab number, and the date.
- Plot a sphere of radius 4 centered at the origin.
- Solve the ODE y"+2y'+y=0 with initial conditions
y(0)=4, y'(0)=4.
- Find all local and global maxima and minima of
f(x)=3x4-8x3-90x2+30 on the
interval [-10,10].
- Memory addresses are often represented in the CPU by a 8 digit hexadecimal
number (i.e. using 32 bits = 4 bytes). Find the maximum amount of addressable
memory in a 32-bit computer.
- Express the rational function r(x)=(x3-4x)/(3x+6x2+9+12x3)
with the numerator as a product of linear factors and the denominator has larger
powers of x written first.
- Determine whether 81279812734 is prime, and find the first prime
following this number if it is not.
- For the function f(x)=1/(x2+1), find the
antiderivative and definite integral of f(x) from 0
to infinity.
- Solve the simultaneous system of equations
| 5x1 | + | 3x2 | + | 2x3 | = | 0 |
| 8x1 | + | 4x2 | + | 2x3 | = | -3 |
| 3x1 | + | 5x2 | + | 7x3 | = | 6 |
Top
Back to the course information page