Math 173
Calculus I
Spring 2005
Dr. Constant J. Goutziers
Department of Mathematics, Computer Science and Statistics
goutzicj@oneonta.edu
Lesson 1
Maple Basics
Maple is an interactive mathematical software package which combines, Numerical Computation, Symbolic Computation and Graphics.
Initializations
| > | restart; with(plots): |
Warning, the name changecoords has been redefined
1.1 Numerical Computation
All arithmetic is exact, unless we explicitly ask for a decimal approximation using the evalf command.
Examples
Example 1.1.1
Rational numbers, large integers, trigonometric values and decimal approximations.
| > | n1:=(2/7)^4; |
| > | n2:=evalf(n1); |
| > | n3:=73491097^6; |
| > | n4:=cos(Pi/6); |
| > | n5:=evalf(n4); |
| > |
Example 1.1.2
Decimal approximations of arbitrary length.
Decimal approximations of arbitrary length can be obtained by specifying the desired number of significant digits as an option in the evalf command. The default is ten significant digits.
| > | n6:=evalf(n4, 30); |
Example 1.1.3
Non-trivial trigonometric values
Some non-trivial trigonometric values can be found by using the convert to radical routine.
| > | n7:=cos(Pi/24); |
| > | n8:=convert(n7, radical); |
Exercises
Exercise 1.1.1
Compute the exact value as well as a decimal approximation of
.
| > |
| > |
1.2 Graphics
Maple contains an extensive array of plotting routines, most of which can be found in the plots package which is loaded using the with(plots) command which is conveniently placed in the Initializations group at the top of this worksheet.
Examples
Example 1.2.1
The
plot
command.
| > | plot(sin(x)/x, x=-10..10); |
| > |
Example 1.2.2
The
color
option with the
plot
command.
We visualize the curve
and color it blue.
| > | plot(x^3-2*x^2, x=-2..3, color=blue); |
| > |
Example 1.2.3
Limiting the Range of a plot.
The rational expression
is not defined at
and
. Moreover when
is close to either one of these values the absolute value of the expression becomes extremely large. In order to circumvent this complication, we limit the range of the plot with the option
y = -10 .. 10
.
| > | plot((3*x^2+5*x-4)/(x^2-9), x=-7..7, y=-10..10); |
| > |
Example 1.2.4
Multiple plots in one picture.
We can create multiple plots within one frame by using Maple set notation { ... } or list notation [ ... ] .
| > | plot({x^2, 3-2*x}, x=-4..3); |
| > |
Set notation will work with any plot routine within Maple, list notation is only implemented for some. The advantage of list notation is that it allows for control of the color of individual curves.
| > | plot([x^2, 3-2*x], x=-4..3, color=[blue, red]); |
| > |
Example 1.2.5
Code and display the function
Use the piecewise command.
| > | f:=piecewise(x<1, 1, x>=1, 3-x); |
Observe that this function "jumps" at the point
. We say that it is discontinuous at
. Maple can be informed about this discontinuity by adding the
discont = true
option to the plot command.
| > | plot(f, x=-4..4, discont=true); |
Example 1.2.6
Three dimensional images.
Maple can create three-dimensional graphs. Here is the picture of a saddlepoint surface.
| > | plot3d(x^2-y^2, x=-5..5, y=-5..5, style=patch, axes=boxed); |
Exercises
Exercise 1.2.1
Sketch the graph of
and use magenta as the color of the curve.
| > |
| > |
Exercise 1.2.2
Sketch the graph of
. Make sure that you choose the domain in such a way that the characteristics of the function around
are clearly displayed.
| > |
| > |
1.3 Symbolics
The real power of Maple lies in its symbolic capabilities. A computer algebra system allows the user to execute mathematical computations on the computer screen much like such they used to be performed with pencil and paper. This section explores some of the capabilities of the program.
Examples
Example 1.3.1
This example illustrates the use of the
expand, factor
and
sort
commands.
| > | e1:=(2*x-3*x^2)^2*(4*x-5)^3; |
| > | e2:=expand(e1); |
| > | e3:=sort(e2, x); |
| > | e4:=factor(e3); |
| > |
Example 1.3.2
Expressions and Functions.
All computer algebra systems make a clear distinction between expressions and functions . A function has to be associated with an argument (variable).
Maple syntax for an expression g is given by: g:=expression_body; Maple syntax for a function f of variable x is: f:=x->function_body; A few examples say more than a thousand words.
We define the expression g equal to
as well as the function
. Then we evaluate f` for x=a, x=2 and x=5t+1.
| > | g:=x^2+7; |
| > | f:=x->x^2+7; |
| > | f(a); |
| > | f(2); |
| > | f(5*t+1); |
| > |
Example 1.3.3
Solve the equation
.
| > | eq1:=a*x^2+b*x+c=0; |
| > | sol1:=solve(eq1, x); |
| > |
Example 1.3.4
Simultaneously solve the equations
and
.
| > | eq2:={3*x-4*y=1, 5*x+7*y=-3}; |
| > | sol2:=solve(eq2, {x, y}); |
Exercises
Exercise 1.3.1
Compute the exact value and a decimal approximation of (1231/12)^11.
| > |
| > |
Exercise 1.3.2
Plot the graph of
`.
| > |
| > |
Exercise 1.3.3
Plot in one picture the graphs of
and
.
| > |
| > |
Exercise 1.3.4
Define the Maple function
and compute
.
| > |
| > |
Exercise 1.3.5
Solve the system of equations
and
.
| > |
| > |