The VectorCalculus Package in Maple 8
Copyright 2002 Waterloo Maple Inc.
Maple 8 provides a new package called VectorCalculus for computing with vectors, vector fields, multivariate functions and parametric curves. Computations include vector arithmetic using basis vectors, "del"-operations, multiple integrals over regions and solids, line and surface integrals, differential-geometric properties of curves, and many others.
You can easily perform these computations in any coordinate system and convert results between coordinate systems. The package is fully compatible with the Maple LinearAlgebra package. You can also extend the VectorCalculus package by defining your own coordinate systems.
Warning, the assigned names <,> and <|> now have a global binding
Warning, these protected names have been redefined and unprotected: *, +, ., Vector, diff, int, limit, series
Creating Vectors and Vector Fields
It's usually convenient to specify a default coordinate system using the SetCoordinates function. (For a listing of the 37 coordinate systems predefined in Maple, see the help page ?Coordinates).
You can define vectors in the same way you do with Maple's LinearAlgebra package, using either the Vector constructor, or <> notation. Note the output appears in terms of the cartesian basis vectors , and . Vectors defined this way are recognized by the LinearAlgebra pakcage.
The MapToBasis function converts vectors and vector fields to other coordinate systems.
A vector field is a data type in the VectorCalculus package. The bars over the basis vectors distinguish vector fields from constant vectors.
Evaluate the vector field F at a particular vector, say , using the evalVF function
Change the default coordinate system to polar.
Define a vector field in the polar coordinate system.
Below we see that the value of the basis vector is not constant over the plane. This is a major difference from cartesian coordinates, in which the basis vectors and are constants over the plane (i.e. and .) You can use Maple to clarify this common point of confusion for students.
Operations on Vectors and Vector Fields
Basic Arithmetic
The package is not limited to three dimensions. The cartesian option without variables specified allows you to compute with vectors of any dimension.
Vector addition and scalar multiplication over
Dot Product, Divergence and Del
The . operator and the DotProduct function are equivalent ways to compute vector dot products.
You can compute the divergence of a vector field using either the Divergence function, or the dot product with the Del or Nabla operators.
Cross Product, Curl and Del
To compute the cross product of two vectors in , use the CrossProduct function or the &x operator.
Compute the curl of a vector field F using either the Curl function or the expression Del &x F.
Note that Maple distinguishes the vector 0 from the number 0 by writing a basis-vector next to the 0.
Here's a nonconservative (rotational) vector field.
We know that it's nonconservative because its curl is nonzero.
Routines from the plots package can accept outputs from the VectorCalculus package.
Multivariate Differential Calculus
Earlier versions of Maple could already perform multivariate differential calculus, but the VectorCalculus package makes it especially simple and intuitive. Working with gradients, laplacians and hessians of real-valued functions is straightforward, as the following worked examples show.
Laplacians, Gradients, and Hessians, Oh My!
Example 1: Find the unit vector normal to the surface at the point
We'll solve this problem as students are taught. Introduce the 3-variable function and treat the surface as the level surface
The normal to the surface at p is just (grad f)(p) , since the gradient of f is normal to f' s level surfaces. We compute the gradient with the function Gradient ...
...and evaluate the gradient at p with the evalVF function.
Finally, we normalize the gradient vector with the Normalize function from the LinearAlgebra package.
A plot of the result.
Example 2: Find the point on the paraboloid closest to the point
We'll solve this as a constrained minimization problem using the Lagrange Multiplier Theorem. Interpret the paraboloid as a level surface of the function .
Let the objective function f be the squared distance from point p to a point . We wish to minimize f .
Form the Lagrangian for the constrained minimization problem,
Compute the gradient of the Lagrangian.
Solve the four equations g = 0, GL = 0 for the four unknowns x, y, z and
Verify that the solution is a minimum using the generalized 2nd-derivative test, i.e.,
The determinant is negative at the solution found, so the solution is a minimum.
Example 3: Solve the time-dependent heat equation for a cylindrical heat source with external heat generation
We find a general solution to the time-dependent heat equation in cylindrical coordinates, where is the temperature, q is the thermal source strength, and k is the thermal diffusivity.
The Laplacian function is convenient for writing down the PDEs of classical physics, especially in non-cartesian coordinate systems.
Solve the partial differential equation.
Multivariate Integral Calculus
The VectorCalculus package greatly simplifies integration of both real- and vector-valued functions over geometric regions in and , such as rectangles, parallelepipeds, circles, ellipses, spheres, triangles, tetrahedra, and regions bounded by curves and surfaces.
Definite Integrals of Multivariate Functions over Regions and Solids
VectorCalculus overloads Maple's int routine to include options for specifying the geometry of the region of integration.
Compute over the region
Compute over the circle with center and radius r , and over all of
Find the volume of the solid bounded by the paraboloid , the plane , and the surface . We use the Region option
Compute where S is the tetrahedron with vertices
Find the area of the section of the ellipse from the angle through the angle
Line and Surface Integrals of Vector-Valued Functions
VectorCalculus has top-level functions for path, line and surface integrals. You can specify the paths of integration with options such as LineSegments , Path , and Arc .
Compute the line integral for over the unit square, demonstrating that F is a nonconservative vector field.
Compute the line integral for over the path as t ranges from 0 to 2 .
Compute the line integral for over the ellipse in the first quadrant .
Compute the surface area of a sphere
Compute the surface area of the plane over the triangle in the xy-plane that has vertices
Operations on Parametric Curves
The VectorCalculus package provides tools to analyse the differential-geometric properties of curves, such as torsion, normal vectors, radius of curvature, TNB frames, and others.
Example: Draw the evolute of an ellipse
The evolute of a curve is the locus of its radius of curvature. To compute the evolute of an ellipse, we first express the ellipse as a parametric curve.
Compute the normal vector of the ellipse as a function of t .
Scale the normal vector to a unit vector by dividing it by its length.
Compute the radius of curvature of the ellipse
The evolute is then the normal vector scaled by the radius of curvature at each value of t .
Extending the VectorCalculus Package
You can add your own coordinate systems to the database of predefined systems in VectorCalculus using the AddCoordinates function .
Let's define the polarbear coordinate system as
Now we can perform any computation we wish in polarbear coordinates.