Contents
1. Fundamentals
2. Curves, Frenet Apparatus
3. Surfaces, Gaussian
Curvature
4. Plots
Starting Up
A few management details
such as how to start Maple and input a command depend on your
particular computer system and are best learned locally--from
documentation or other users.
Help
Maple has reasonable
error notification and excellent on-line help. For common terms,
?term will produce a detailed description (no semicolon required).
The Maple Learning Guide, is a good
introduction to the latest version of Maple; it may be obtained
from the website maplesoft.com.
Syntax
Maple has a distinctive command unapply that converts mathematical expressions into functions. For example, if expr is an expression in u and v, then unapply(expr,u,v) gives the corresponding function, which can be evaluated, not just on u,v, but on 3.1,2.5 or a,b and so on.
Many Maple commands are contained in packages. Commonly used ones are plots and LinearAlgebra. The latter is essential for matrix operations, however we will not need it.
Calculus
Functions are usually given by the arrow notation. For example,
f := x -> x^3-2*x+1 or g := (u,v) -> u*cos(v)-u^2*sin(v)
Then f can be evaluated on a or 3.14 or a2+b2, etc.
Derivatives (including partial derivatives): diff(f(x),x) or diff(g(u,v),v).
Definite integrals: int(f(x), x=a..b) or int(g(x,y), x=a..b, y=c..d).
If these commands cannot produce an explicit value, then evalf(%) gives a numerical result.
Vectors
Maple distinguishes
sharply between the n-tuple [v1,...,vn], which is a list, and
the corresponding Vector Vector([v1,...,vn]).
(In earlier versions, "vector" was used instead of "Vector.")
Lists and Vectors cannot interact, and lists are generally easier to work with. Thus two n-tuples are added in the usual way by v+w and scalar multiplication of v=[v1,...,vn] by a number s is s*v = [s*v1,...,s*vn].
Another advantage of lists--a decisive one--is that an operation applied to a list is applied automatically to each entry of the list. (See scalar multiplication above and diff in the next section.)
As we soon see, Maple describes curves and surfaces by means
of lists. Thus we prefer to stay in the "list" world and avoid the "Vector"
world, which requires reading in the package LinearAlgebra. So long
as matrix operations are not involved, this can be accomplished by defining
the two most basic vector operations in terms of lists.
First, note that the ith entry of a list p := [p1,
p2,...,pn] is displayed by the command p[i].
>Dot product: dot := (p,q) -> simplify(sum(p[i]*q[i], i=1..nops(p)))
>Cross product: cross := (p,q) -> simplify(
[p[2]*q[3]- p[3]*q[2], p[3]*q[1]-p[1]*q[3], p[1]*q[2]-p[2]*q[1]])
To which we add:
>Triple scalar product: tsp := (p,q,r) -> dot(p, cross(q,r))
The dot product has been defined for n-tuples of any length n ("nops(v)" is the length of v). The cross product is, of course, special to dimension 3, and hence so is the triple scalar product. Note that tsp(p,q,r) is just the determinant of the matrix with rows p,q,r, so reversal of any two entries gives (only) a sign change.
The command "simplify" used in these definitions is the principal Maple
simplification weapon; however it cannot be expected to give ideal results
in every case. Human intervention is often required, either to do hands-on
simplification or to use further refinements (see ?simplify). But,
of course, many results do not have simple descriptions.
The built-in "simplify" above will reduce the number needed in later
work.
All three of the above commands can be saved in Maple's concise machine language by:
(previously written as save(dot, cross, tsp, `dotcrosstsp.m`), using backquotes.) Then the commands are read into later sessions by
A curve in any Rn is a list-valued function whose entries are expressions in a single variable. For example,
describes a helix in R3. Then the vector derivative (i.e., velocity) of c is returned by diff(c(t),t), which differentiates each component of the curve by t.
Curves with parameters: For example, using the unapply command, the curve c can be generalized to
Then helix(2,3) gives c as above.
Frenet apparatus
We now show how the Frenet formulas in Theorem 4.3 of Chapter 2 [EDG2] can be expressed in terms of Maple.
The curvature function
of a curve
c is given by
kappa := c -> unapply(simplify(
dot(cross(diff(c(t),t), diff(c(t),t,t)), cross(diff(c(t),t),diff(c(t),t,t)))^(1/2)/
dot(diff(c(t),t),diff(c(t),t))^(3/2)), t)
Here "unapply" makes kappa(c) a real-valued function on the domain of c. Otherwise, it would merely be an expression in t and could not be evaluated on real numbers or other variables.
The torsion function
of a curve c is
given by
tau := c -> unapply(simplify(
tsp(diff(c(t),t), diff(c(t),t,t), diff(c(t),t,t,t))/
factor(dot(cross(diff(c(t),t), diff(c(t),t,t)),cross(diff(c(t),t), diff(c(t),t,t))))), t)
The distinction between functions and mathematical expressions is always important. Thus, with notation as above, tau, applied to a curve, say helix(3,2), is a real-valued function whose value at a number or variable s is given by tau(helix(3,2))(s).
The unit tangent,normal, and binormal vector fields T, N, B of a curve c are given by
tang := c -> unapply( dot(diff(c(t),t),diff(c(t),t))^(-1/2) * diff(c(t),t), t)
nor := c -> unapply(cross(binor(c)(t),tang(c)(t)),t)
For the binormal we use a procedure, an enclave within which definitions can be made that do not escape to the outside. These "local" definitions allow the final formula to be expressed more clearly.
binor := proc(c) local crt; crt := cross(diff(c(t),t),diff(c(t),t,t));
unapply(simplify(factor(dot(crt,crt)))^(-1/2) * crt,t) end proc
(In both cases above, the asterisk denotes scalar multiplication.) Unless the curve c is rather simple, its normal vector--or even its binormal--may remain rather complicated
x := (u,v) -> [2*u*cos(v),2*u*sin(v),3*v];
parametrizes a helicoid in R3.
The following commands, applied to a parametrization x, return the metric coefficients E,F,G. For Maple we usually represent capital letters (E) by double lower case letters (ee) since some capitals have special meaning for Maple
ee := x -> unapply(dot(diff(x(u,v),u),diff(x(u,v),u)),u,v)
ff := x -> unapply(dot(diff(x(u,v),u),diff(x(u,v),v)),u,v)
gg := x -> unapply(dot(diff(x(u,v),v),diff(x(u,v),v)),u,v)
The distinction between functions and expressions is always crucial. Applying ee (a function that feeds on functions) to a parametrization x (a function) gives a real-valued function ee(x) which can be applied to any x1,x2, not just u,v. But ee(x(u,v)), for example, will fail, since x(u,v) isn't a function.
A frequently used combination:
ww := x -> unapply(simplify( ee(x)(u,v)*gg(x)(u,v) - ff(x)(u,v)^2)^(1/2),u,v)
Three other basic functions L, M, N derive from the second derivatives xuu, xuv, xvv. They describe the shape of the surface in R3 and are given by Maple as:
ll := x -> unapply(tsp(diff(x(u,v),u,u),diff(x(u,v),u),diff(x(u,v),v))/ ww(x)(u,v),u,v)
The formulas for mm and nn are the same, except that the double derivative u,u is replaced by u,v and v,v, respectively.
These commands are saved for future use by: save ee, ff, gg, ww, ll, mm, nn,"efgwlmn.m".
Gaussian Curvature
Here we define gaussK, the command that gives the fastest way to compute the Gaussian curvature of a parametrized surface in R3. For such a surface, there is a standard formula for Gaussian curvature:
K=(LN- M2)/(EG-F2)
The command gaussK results when the Maple commands for E,F,G,L,M,N are substituted into the formula above. Again we use a procedure:
gaussK := proc(x) local xu,xv,xuu,xuv,xvv;
xu := diff(x(u,v),u); xv := diff(x(u,v),v);
xuu := diff(x(u,v),u,u);
xuv := diff(x(u,v),u,v);
xvv := diff(x(u,v),v,v);
unapply(simplify(factor(
tsp(xuu,xu,xv)*tsp(xvv,xu,xv) - tsp(xuv,xu,xv)^2)/
(dot(xu,xu)*dot(xv,xv) - dot(xu,xv)^2)^2),u,v) end proc
Here tsp is the triple scalar product defined earlier. As usual, gaussK should be saved for future use by save gaussK, "gaussK.m".
Test of gaussK: The unit sphere in R3 is parametrized by
x[u,v] := [cos(v)*cos(u),cos(v)*sin(u),sin(v)]
If all is well, gaussK(x)(u,v) gives K=1.
(1)The command plot has two uses:
(i) Graphs. If f is a real-valued function defined on a
t
b, then plot(f(t), t=a..b)
draws its graph.
(ii) Parametric plots. If g is another such function, then the curve c(t) := [f(t),g(t)] is plotted in R2 by plot(c(t), t=a..b).
Plots can be modified by options, thus: plot([c(t), t=a..b], <option>), where, for example, the option numpoints=300 would increase the smoothness of the plot, and scaling=constrained imposes the same scale on the axes. Use ?plot[options] to get many others.
(2) The command plot3d also has two uses. Let D
be a region a
u
b, c
v
d
in R2. Then
(i) Graphs. If f is a real-valued
function defined on D, its graph is plotted by plot3d(f(u,v),
u=a..b, v=c..d).
(ii) Parametric plots. If x:
D
R3 is a
list-valued patch or parametrization, its image is plotted by
plot3d(x(u,v), u=a..b, v=c..d).
Again, ?plot3d describes a number of ways to specify plot style.
(3) Parametrized curves in R3 are plotted using the command "spacecurve" from the plots package (installed by with(plots). Then, for example: spacecurve(c(t), t=-2..4).
To show more than one plot on the same page, each plot should be named, say, A := plot3d(x(u,v), u=0..1, v=0..Pi): with terminal colon to avoid a flood of numbers. Then use "display" from the plots package: display([A, B,C])
These notes should provide a start to using Maple in the study of the differential geometry of curves and surfaces. The essential dot-m files it presents are