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[CalculusI]);". 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) Riemann Sums- Maple is especially adept at computing Riemann sums ao pick
three (3) functions of your own choice (make them nontrivial so Maple has to do
some work) and some intervals to estimate the area under a function. For each one do two
of approximations with different numbers of rectangles (or trapezoids or parabolas
for the trapezoid and Simpsons rule). Include the graph, the sum formulas,
and the numerical value. For one of your functions use the Trapezoid and Simpson
approximations and for the other two you can pick between left, right and midpoint
approximations.
Some relevant commands:
Note the following can be loaded using the with(student); command (note student is lower case).
leftbox(f(x),x=a..b,n) draws the left endpoint approximation to the area under f(x) from
x=a to x=b using n rectangles for ex. leftbox(sin(x),x=0..Pi,20); will graph an approximation
to sin(x) from x=0 to x=Pi using 20 rectangles. Make sure it looks correct. If you
want to fancy it up you can ad options like leftbox(f(x),x=a..b, n, color=RED, shading=GREEN).
leftsum(f(x),x=a..b,n) gives the summation formula for the left hand sum- make sure
to verify it is giving the correct formula.
evalf(leftsum(f(x),x=a..b,n)); gives the numerical value for the sum (evalf="evaluate
using floating point arith." if you care)
Similarly there are commands for the right endpoint rectangles,
rightbox(f(x),x=a..b,n), rightsum(f(x),x=a..b,n), and of course you will need to do
evalf(rightsum(f(x),x=a..b,n)) to get the numerical value.
For midpoints the commands are middlebox(f(x),x=a..b,n) and middlesum(f(x),x=a..b,n).
Other approximations can be done using trapezoids or a rule called Simpson's rule which we will get
to in class that effectively uses parabolas instead of rectangles. I do not think
there is a graphing option for these, so do not worry about a picture, just use them and get numerical
values. The commands are:
trapezoid(f(x),x=a..b,n) and simpson(f(x),x=a..b,n)
(2) Maple can of course compute antiderivatives or definite integrals, so have it
integrate at 5 indefinite integrals and 5 definite integrals. For each do one that is easy
that you can verify, and for the rest make them nasty so Maple has to work. However,
do not accept strange functions as outputs for the indefinite integrals- if you like you
can take harder problems from the text (especially sections 7.5 and 7.6). For the definite
integrals, also plot the area you are graphing using the plot command. Also include
two improper integrals see section 7.8 of the text.
Relevant commands:
int(f(x),x) computes the indefinite integral (antiderivative) of the function
f(x), for example int(exp(2x),x); returns (1/2)e^(2x).
you can also use
intparts(udv, u); to have maple do integration by parts for example
intparts(sin(x)cos(x), sin(x)) does integration bu parts on the integral with u set to sin(x).
int(f(x),x=a..b) returns the definite integral of f(x) from x=a to x=b, for example
int(sin(x),x=0..Pi); returns the definite integral of sin(x) from x=0 to x=Pi.
plot(f(x),x=a..b) plots the function f(x) from x=a to x=b, you can also set the y values
if you like.
(3) Investigate the "Error Function", in (2) you were asked to avoid strange
functions but in this part you will investigate one of these and answer in your
own words (in a separate text line) the following questions. First investigate it,
try int(exp(-x^2,x), and look up the definition from the help menu, plot the function
exp(-x^2) for a range that gives an interesting graph, also plot the error function
plot(erf(x),x) for the same range. You can use evalf(erf(a)) to compute numerical
values of this function for whatever values you like. You can use the command
limit(f(x),x=a); to evaluate limits, in particular you can use limit(exp(-x),x=infinity);
to compute the limit at infinity of e^(-x). You can also use diff(f(x),x) to have Maple
compute derivatives.
In your own words, describe what the error function is, explain the relationship in the
graphs of e^(-x^2) and erf(x), do the values of erf(x) seem reasonable given the definition,
describe the behavior of both functions at x= +/- infinity. Where is the derivative
of erf(x) a maximum? Where does erf(x) achieve a maximum value?
(4) 3-Dimensional fun. One of the most fun aspects of Maple is the 3-d graphs
in this part we will just investigate volumes of revolution- but feel free to play with
others. Create and study three 3 volumes of revolution, for each one find the numerical
value of the volume, the integral formula for the volume, and the plot of the volume.
Be sure to play with the output of the plot function- for example if you click and drag
the mouse on the graph you can change the perspective- if you right click you have
tons more options to play with.
Do one around a horizontal axis, one around a vertical axis, and at least one
that is not just the x-axis or y-axis, for example x=-6.
First load more special packages
with(Student[Calculus1]): you can use a semicolon if you would like to see the
new functions that were loaded.
This command is a bit complicated so let me try
to break it down a bit
VolumeOfRevolution(f(x),x=a..b,axis=word1, distancefromaxis=a,output=word2);
This command does something (word2) with the volume of revolution produced by
rotating the area under the curve f(x) from x=a to x=b.
First choose an axis by setting word1 to be either horizontal or vertical.
The distance from axis determines which line you rotate about for example if
...axis=horizontal, distancefromaxis=-6,... rotates about the line x=-6.
word2 can be set to value, integral, or plot which then returns either the
numerical value of the volume, the integral to evaluate to compute the volume,
and the plot of the volume (this is the most fun).
Examples:
VolumeOfRevolution(sin(x),x=0..Pi, axis=vertical, distancefromaxis=-1, output=plot);
returns a plot of the volume of revolution produced by rotating the area under
sin(x) from x=0 to x=Pi about the line y=-1.