Some Maple Basics- first off like most computer programs Maple is fussy
about syntax. For example of the four options "cos(x), Cos(x), Cos[x], cos[x]"
only one works (the first). Of course one must also be careful about parentheses for example
"2^3x" does not necessarily mean the same thing as "2^(3x)". The help menu is
very good though and describes (though one must find the info) exactly how to use each
function with examples that one can cut and paste into your own worksheet.
Also note: in Maple a semicolon or colon, ";" ":" is used to make the end of a
command, the colon means to "suppress output" in otherwords it does the calculation
but does not show the result on the screen. So generally you will want to use a
semi-colon so you can see the output.
Note also that many of the functions we need are included in a special package so
one of the first commands you shuld give Maple is "with(Student);" this will load the
special functions we need- not experiment first with the semi-colon and then with the
colon- we do not need to see this output (it lists the new commands it knows) so in your final
worksheet just use a colon. Note you only need to load this once per session, but Maple
forgets everything when you restart or restart the kernel (the calculating processor), so if you
reopen a worksheet you started earlier you will need to have Maple re-execute any commands
you need - for example the "with(Student):" command. Also like many programs Maple uses the
command ":=" as assign, so "a:=2;" assigns the value of 2 to "a", so if you input "a;" Maple will
spit out "2".
If you discover any tricks that you think are useful or helpful, please email them to me
and I will post them on this page.
Tip/Note 1: the package that used to be called "student" as in "with(student);" has been updated though the old version will work, the updated set of packages command is called "Student[Calculus1]", as in "with(Student[Calculus1]);". Many of the commands that are given are using the old package "student". I have updated them to include the "Student[Calculus1]" versions also
(1) 3-Dimensional Fun: Pick two functions and create surfaces of revolution by rotating about
an axis (so for example do one around the y-axis and one about x=3). For each
surface, graph the surface you are computing the area of, give an integral representing the area of the surface,
and compute the numerical value of the surface area. First load the special packages with(Student[Calculus1]): then
The relevant command is:
SurfaceOfRevolution(f(x), x=a..b,axis=word1 , distancefromaxis=c, output=word2);
f(x) here is the function to be rotated about an axis, the section between x=a and x=b is rotated,
word1 must be set to either vertical or horizontal, distance from axis is used to rotate about
an axis other than the x or y axis, word2 can be set to either intergal, plot or value.
So for example
SurfaceOfRevolution(sin(x), x=0..Pi, axis=horizontal, distancefromaxis=2,output=plot);
gives a plot of the surafce of revolution from rotating sin(x) from x=0 to Pi about the line x=2.
(2)Parametric and Polar Equations/Curves:
Maple can handle either equations and curves defined parametrically or in polar coordinates.
First, have Maple graph three curves defined parametrically, and three defined in polar coordinates.
To plot a curve given by parametric equations x=f(t), y=g(t), we just use the plot command with some extra brackets:
plot([f(t),g(t),t=a..b]); will plot the curve from t=a to t=b (note we can also use t=2..infinity to plot from t=2 to infinity).
So for example plot([cos(x),sin(x),x=0..2Pi]); gives a plot of the unit circle.
To plot in polar coordinates we must use the parametric version and let Maple know we are using Polar coordinates
so we first must write out polar equation parametrically, for example a curve in the form r=sin(theta)
can be written paratemtrically as theta(t)=t, r(t)=sin(t) so the relevant command is:
plot([r(t),theta(t),t=a..b],coords=polar);
so for example to graph the cardiod r=1+sin(theta) from theta=0 to theta=2Pi we could use
plot([1+sin(t),t,t=0..2Pi],coords=polar);
(3) Evaluating sums:
Computers are excellent tools for busy work, so first have Maple evaluate a two
definite sums (make them somewhat complicated and have Maple add up a lot of terms). The
command for this is:
sum(f(k),k=a..b); this will give the sum of f(a)+f(a+1)+f(a+2)+...+f(b) for example
sum(k^(-1/2),k=1..100); sums all terms of the form 1/sqrt(k) where k runs from 1 to 100.
Note that you may need to use evalf to get a numerical value, so for example evalf(sum(k^(-1/2),k=1..100));
will give a decimal approximation to the above sum.
Maple will also add up infinite sums for example sum(1/k^2,k=1..infinity); So have Maple evaluate three infinite series, do one geometric series so you can check the result, one that diverges, and one that converges (as always- pick interesting series, you can take some from the text if you like).
(4) Taylor Series:
Maple can also compute the Taylor series for a function (an analytic function).
The relevant command here is: taylor(f(x),x=a,n); which gives the first n terms of the
Taylor series for f(x) centered at the point x=a.
For example: taylor(exp(x),x=2,5); returns the first five terms of the Taylor series for
e^x centered at the point x=2. So, pick three functions (as always pick interesting) and
compute the first few terms of each Taylor series - make sure to pick different
centering points and different numbers of terms for each.
Then for
each one have Maple plot the original function and the Taylor approximation to the function on the same axes.
Note to plot multiple functions (in the example will plot three) on the same axes
use plot([f(x),g(x),h(x)], x=a..b);
Another command you may want to play with (though you need not turn in) is
with(Student[Calculus1]): TaylorApproximationTutor();
this allows you to animate and play with the Taylor approximations.