The VectorCalculus Package
This worksheet demonstrates examples using the VectorCalculus and Student[VectorCalculus] packages. The StudentVectorCalculus example worksheet provides additional examples, particularly of the Student[VectorCalculus] features for plotting, animation and interactive tutors.
|
Initializations
|
|
|
|
Basic Objects
|
|
The main objects upon which this package operates are the free vector, the PositionVector, the RootedVector, the VectorField, curves, surfaces, and scalar fields. Lists cannot be used in place of vectors, and scalar fields are ordinary Maple functions and expressions. Information about vector objects - coordinate systems and names of coordinates - are stored as attributes of the vector objects. The About, attributes, and GetCoordinates commands can be used to recover this information.
The free vector is is created in one of two ways. The angle-bracket notation creates a free vector in the extant coordinate system. At this point in this worksheet, that coordinate system is Cartesian.
The explicit use of the Vector command permits attaching coordinates to the free vector.
In each case, the free vector is really a point. In Cartesian coordinates, the free vector is a vector from the origin to the point , and the identification of the point with the free vector is permissible because the unit basis vectors are everywhere parallel.
By analogy, the free vector is a point in a rectangular frame with axes labeled (horizontal) and (vertical). In this frame, the point with polar coordinates is connected to the origin with an arrow, and this arrow is .
Information about and is obtained as follows.
The VectorField command is used to create a vector field.
The unit basis vectors and are used in place of and , respectively. The bar denotes that the domain of these basis vectors is the underlying Cartesian space, and that the vectors themselves are position dependent. Of course, in Cartesian coordinates, these basis vectors are independent of position, but the bar is still used to denote that these are the "moving" basis vectors that are defined at each point in the space supporting the vector field, and that are given in the coordinate system in which the vector field is given.
Alternatively, the vector field
defines a field of vectors whose domain is each point (except for the origin) in the Cartesian plane on which the coordinate curves of the polar coordinate system have been "pulled back." This is the familiar view of polar coordinates superimposed on the Cartesian plane - concentric circles as lines of constant , and radial rays as lines of constant . In this view of the change of coordinates to polar coordinates, the vectors and are position dependent. These "moving" basis vectors change direction from point to point, and are not to be confused with the basis vectors appearing in
If the evalVF command is used to evaluate the vector field G at a point in the Cartesian plane, the result is a RootedVector. For example, evaluating at the Cartesian point whose polar-coordinate description is is effected by
because the free vector is the Maple representation of the point whose polar coordinates are . Indeed, we have
The root point is the point of "attachment" for the single vector , which is actually a "bound" vector, bound to the root point.
A rooted vector can be defined directly with the RootedVector command.
To verify that this is a vector in polar coordinates, rooted at the polar point use
Information about the rooted vector is actually stored in a module that could be created with the VectorSpace command.
The vector space is the set of all vectors of appropriate dimension that have their root point at The basis for this vector space are the vectors the moving basis vectors defined at the root point. Individual vectors in this space can be created as module exports via the syntax
That is the vector rooted at the point can be see with
Creating rooted vectors via the VectorSpace command works well when many such vectors will have the same root point. The RootedVector command is most convenient for single rooted vectors.
Finally, there is the PositionVector command that creates the radius-vector form of curves and surfaces. The vectors
are position vectors, vectors from the origin of a Cartesian frame to the relevant point in that frame. Points can be parameterized by up to two parameters; a one-parameter family of points represents a curve, and a two-parameter family, a surface. Indeed, we have
The PositionVector construct applies only in Cartesian coordinates. The Position Vector
describes the origin-centered circle of radius 2 drawn in the Cartesian plane, as we see from
Consequently, in the Cartesian plane the PositionVector, the free vector, and the vector rooted at the origin are essentially the same arrow, but because these are represented in the VectorCalculus package by distinct data structures, they are not necessarily recognized by Maple as being the same. Thus, the package provides the ConvertVector command for converting one form of the Cartesian vector to another.
A final word about the visual display of vectors and vector fields in the VectorCalculus package. The default display for free vectors and vector fields is explicitly in terms of basis vectors. This display can be changed to a column-vector format with the BasisFormat command. The setting
causes the displays to be
respectively, for a free vector and a vector field. The PositionVector is always displayed as a column vector.
The MapToBasis command imposes a change of coordinates on a vector or vector field. For example, to express the Cartesian vector field
in polar coordinates, use
This is equivalent to expressing the unit basis vectors and in terms of the vectors and then making the substitutions . This calculation can be carried out from first principles if the following position vector is first defined.
The basis vectors and are obtained from R via
Writing these vectors in terms of and can be done with
Solving for and in terms of vectors and we get
Representing the vector field in terms of and , then replacing and with their equivalents in terms of the vectors and we get
Making the substitutions , we get
A final rearrangement of terms, and an identification of and with vectors and respectively, gives
which compares favorably with
The MapToBasis command can also be used to transform a point in one coordinate system to its representation in another. Setting
will make the result of
easier to understand. The Cartesian point , represented as a free vector, has been transformed to also given as a free vector. This is not a vector transformation. The MapToBasis command applies the contravariant transformation law to a rooted vector or a vector field. Applied to a free vector, it transforms just the components. The basis vectors are not so transformed because the free vector is not a vector; it is really just a representation of a point in curvilinear coordinates.
|
|
Standard Operations
|
|
Three of the top level operators, `+` ( addition ), `*` ( scalar multiplication ), and `.` ( dot product ), have been overloaded to operate on the Vector/attribute combinations created by the package. Within the package, the diff command is also modified. It will act directly on vectors and vector fields without having to be mapped onto the target structures.
Also, a new operator, `&x` ( cross product ), is exported by the package. Where possible, these operators have been extended to understand the standard vector differential operator, Del ( or Nabla ), which is also a package export.
|
Basic Arithmetic
|
|
The top level operators
|
addition
|
|
subtraction
|
*
|
scalar multiplication
|
|
|
have been overloaded to operate on the Vector/attribute combinations created by the package. To illustrate this, first define the following vectors with a common root point.
The basic operations of addition, subtraction, and scalar multiplication are then obtained as follows.
The addition can be corroborated by performing the sum in Cartesian coordinates via
The lengths of the vectors and are respectively
In particular, this calculation highlights the possible misconception that the radial component of a vector expressed in polar coordinates determines the length of that vector. Graphs of the vectors and (the Cartesian equivalent of ) appear in Figure 1, with in black, and in red.
|
|
Figure 1 The vectors in black and (the Cartesian equivalent of ) in red
|
|
|
Since the length of is
it is clear that the length of is a function of both components in polar coordinates, not just the radial component.
|
|
Differentiation of a Vector Field
|
|
Consider the vector field
defined in the parabolic coordinate system for which the transformation equations are
Parabolic coordinates are not as familiar as polar coordinates, so fewer background assumptions will interfere with the following calculations.
The derivative of with respect to is given by
This result can be checked by computing from first principles. To begin, obtain expressions for the unit basis vectors and . For this, start with the position vector , defined in Maple via
The unit basis vectors are obtained from the position vector by the following calculations.
(Differentiation of the PositionVector creates a RootedVector, an object captured in a module data structure. If the normalized form of the vector were simplified with an assumption in the step that creates the module, the root point in the module would be stored with the assumption. Since this later leads to difficulties, the creation of the module is done first, and the simplification with the assumption is done in a second and separate step.)
Noting that and are both linear combinations of and , differentiation of with respect to can take place componentwise. In fact, the derivative of componentwise is
To express in terms of and solve the equations
for and in terms of and Doing this gives
Make these replacements in to obtain as
which compares favorably with
|
|
Tangent Vector along a Curve
|
|
Let
define a space curve in Euclidean space. The "secant vector"
is given by
The vector
tangent to the curve , can also be written as
Of course, this tangent vector could also be obtained with the built-in TangentVector command, as shown by
|
|
Dot Products
|
|
The dot product of free vectors is defined for Euclidean space only. For example, we have
or even
However, in curvilinear coordinates, the dot product between free vectors is not defined because the free vector represents a point, not a vector, in non-Cartesian coordinates. Maple gives the following error for such a calculation.
Error, (in VectorCalculus:-DotProduct) cannot take the dot product of free Vectors in non-cartesian coordinates
| |
The divergence of the vector field
is given by
even though was defined in parabolic coordinates! Alternatively, the divergence of can be obtained with
Recalling that is given in terms of the unit vectors and by the sum
the divergence can also be computed in Cartesian coordinates by use of the chain rule. The computations are slightly simplified if the components of are named
The divergence of , computed in Cartesian coordinates, is given by
where the derivatives of and are
Consequently, the chain rule gives
which, upon substitution for the derivatives of and , becomes
clearly the same as
Other operations with the the nabla, and the dot product appear in Table 1.
the Laplacian operator
|
|
|
|
The directional derivative operator
|
|
Table 1 Additional operations with ∇, the nabla operator, and the dot product
|
|
|
|
|
Cross-Product
|
|
In Cartesian coordinates, the cross-product of the free vectors
can be computed by any of the following three approaches.
In non-Cartesian coordinates, the cross-product between free vectors is not defined because the free vector is merely a notational device for a point. However, the cross-product is defined for rooted vectors such as
Surprisingly, the formalism for the cross-product in such non-Cartesian coordinates as the spherical system is the same as it is in the Cartesian system.
The curl of the vector field
can be computed by any of the following three approaches.
Other cross-products in which the or nabla, appear can be found in Table 2.
Define the operator and apply it to the scalar
|
|
Define the operator and apply it to the scalar
|
|
Table 2 Cross-products in which the or nabla, appear
|
|
|
In the each case in Table 2, the cross-product is with the gradient of the scalar .
|
|
Displaying Symbolic Forms of the Differential Operators of Vector Calculus
|
|
In any orthogonal coordinate system, to display the differential forms of the divergence, gradient, curl, and Laplacian operators, do not specify any arguments for the corresponding Maple functions. For example, to obtain the format of these operators in spherical coordinates, first set the coordinate system to the spherical system with the command
then execute the commands in Table 3.
Divergence
|
|
Gradient
|
|
Curl
|
|
Laplacian
|
|
Table 3 The formal representations of the basic differential operators of vector calculus
|
|
|
Notation such as stands for the th component of a vector field, while the notation stands for a scalar field.
|
|
|
Curves
|
|
|
The Frenet-Serret Formalism
|
|
In the VectorCalculus package, the Frenet-Serret formalism for a curve can be implemented directly, or stepwise. Let be any helix defined by
where The parameter along is taken as because the parameter is not necessarily the time .
The tangent-normal-binormal frame is obtained with
and the curvature, radius of curvature, and torsion are obtained in Table 4.
Curvature
|
|
Radius of Curvature
|
|
Torsion
|
|
Table 4 Curvature, radius of curvature, and torsion for
|
|
|
Note that we have represented the curve via the PositionVector command. It is also possible to represent the curve as a free vector, as we see below.
In Cartesian coordinates, the identification of points and vectors is transparent. In non-Cartesian coordinates, curves represented by free vectors are actually one-parameter sets of points in the rectangular version of the coordinate space defined by the non-Cartesian coordinates.
In addition to the TNBFrame command, the VectorCalculus package has individual commands that compute vectors along each of and The vectors in Table 5 are not unit vectors.
|
|
|
Table 5 Vectors along the unit tangent, principle normal, and binormal vectors
|
|
|
Working from first principles, we obtain by differentiation the vector , tangent to
If the parameter along the curve were the time , this tangent vector would be the velocity vector, and its length would be the "speed." Hence, we use
and compute
The unit tangent vector along is then
The curvature can be computed by the formula
or more directly by its definition
where is the arc length along .
Using the first formula, we obtain
a result equivalent to the direct calculation
The principal normal
is obtained by
The binormal vector can be obtained as leading to the unit vector
The torsion of is the rate at which the binormal varies. In particular, it is defined by
as can be demonstrated in Maple via the calculations
It is easy to show that so that a result verified by
The vector is along the negative of the principal normal because so lies in the plane of and Since and is along it follows that By the right-hand rule, must be along the negative of .
Indeed, for the example at hand, we have
|
|
The Evolute of a Plane Curve
|
|
The evolute of a plane curve (called the involute) is defined as the locus of the centers of curvature of If is described in radius-vector form by then the evolute is given in vector form by
where, along , is the (unit) principal normal and is the radius of curvature.
It turns out that the envelope of the normals along is also the evolute.
For example, let be the ellipse by defined by
The (unit) principal normal is then
and the radius of curvature is
The evolute is then
This is a rooted vector, as we see from
It can be converted to a position vector via
and plotted with the PlotPositionVector command. Figure 2 shows the involute () in black, and the evolute, in red.
|
Figure 2 Involute (in black) and its evolute (in red)
|
|
|
|
|
|
Integrals
|
|
|
Introduction
|
|
At "top level," the int command immediately evaluates a single integral, with Int being the inert form. Multiple (iterated) integrals require repeated applications of these commands.
In the VectorCalculus package, the int command has been modified to recognize multiple (iterated) integration, and to recognize such easily described domains as circles and piecewise linear paths. The inert integral is obtained by including the "inert" parameter.
In addition to the modifications to int, the VectorCalculus package contains the LineInt, SurfaceInt, Flux, ArcLength and PathInt commands, each of which also recognizes the "inert" parameter.
|
|
The Modified int Command
|
|
Although the syntax for the int command is modified in the VectorCalculus package, int continues to function as it does at top level, as we see from
Evaluating the integral
at top level is complicated only by the syntax it takes to write the unevaluated form. Within the VectorCalculus package, we have the alternative
Typically, this integral is evaluated in polar coordinates, as seen from the inert form given by
The integral of
over the triangle whose vertices are is given by
Obtaining this result from first principles is extremely tedious because the edges of the triangle first have to be parametrized, and then two (iterated) double integrals have to be written and evaluated.
In addition to recognizing the domains Circle and Triangle, the int command recognizes Ellipse, Sector, Parallelepiped, Rectangle, Region, Sphere, and Tetrahedron, where Region is used to define more general domains.
|
|
Line Integrals for Work and Flux
|
|
Mechanical work is defined as the line integral (along ) of the tangential component of a force and the flux of a planar force is defined as the line integral of the normal component. The work integral has the same form in any number of dimensions, but the flux integral becomes a surface integral in three dimensions.
Both work and flux are defined for curves parametrized by arc length, but are generally computed using whatever parametrization is convenient. For example, if the force is given by and the curve, by the work and flux integrals are given respectively by
and
where and are unit tangent and normal vectors along . Note that for flux, there is no simple equivalent to the that is available for the work integral.
Let be the vector field defined by
and be the curve defined by
where see Figure 3.
The work done by the field on a particle of unit mass as the particle traverses the circle counterclockwise is given by
The inert form of this integral, namely,
shows how the integral is parametrized. To verify this result from first principles, evaluate the integral
to obtain
Other domains recognized by the LineInt command are Arc, Circle, Circle3D, Ellipse, Line, and LineSegments.
The flux of through is given by
For a closed curve, the Flux command selects the outward normal. Since is not closed, the orientation of the normal is not clear from this result. The net "flow" of the field is against the normal field, but without knowing the direction of the normal field, the direction of the net flow of is as yet unknown.
The principal normal points towards the center of curvature of . The normal to the right of the tangent vector along would point in the opposite direction. Figure 4 shows the tangent and principal normal vectors at one point on . The principal normal (in red) is to the left of the tangent vector (in black).
|
Figure 4 Tangent and principle normal vectors along
|
|
|
Hence, take the normal field as
and compute, from first principles, For the element of arc length along , take
obtained by an inspection of
The flux is again
indicating that the Flux command also took the normal to the right of the tangent vector.
Other curves recognized by the Flux command are Arc, Circle, Ellipse, Line, and LineSegments. In three dimensions, the Flux command recognizes the regions Box, Sphere, and Surface. See below under Surface Integrals for examples of flux through a surface.
|
|
Surface Integrals
|
|
The flux of a vector field through a surface is defined by the surface integral
where is the element of surface area for the surface and is a unit normal field on the surface. If is closed, it is usual to take pointed outward. If is not a closed surface, then the orientation of must be specified for the value of the flux to be meaningful.
Surface flux is the natural generalization of the planar flux of a field through a curve.
The flux of the vector field
through that portion of the plane
lying inside the cylinder whose footprint in the -plane is a circle with center at and radius 2 is given by
To obtain this result from first principles, let be the unit upward normal field
The flux of through is then given by the surface integral
Alternatively, if is given by
the flux of through is then given by
In addition to the Surface parameter, the Flux command recognizes the surfaces Box and Sphere.
|
|
|
The Lagrange Multiplier Method for Constrained Optimization
|
|
The shortest distance from the point to the plane where is given by
can be found by the Lagrange multiplier technique in which points where the gradient of the objective function
is collinear with the gradient of are found. This is most easily done by solving the equations
in conjunction with the constraint equation . This is readily done with
|
|
Extensibility
|
|
As well as having access to the built-in coordinate systems, you can add coordinate systems to the package so that all of the VectorCalculus commands can compute in this coordinate system. The only requirement is that the unit basis vectors of this new coordinate system must be orthogonal with one another.
In addition to the built-in (orthogonal) coordinate systems known to the VectorCalculus package, additional coordinate systems can be added to Maple via the AddCoordinates command. If the new coordinate system is also orthogonal, Maple will be able to implement vector operations in that system. If the new system is not orthogonal, Maple issues a warning, but permits the system to be added to the global coordinate system table upon which graphing commands are based.
For example, to add the orthogonal system determined by the equations
use
Setting the default coordinate system via
allows calculations such as
and
Adding a non-orthogonal system such as
generates the warning
Warning, the unit Vectors in the new coordinate system are not orthogonal, only added to global coordinate systems
| |
However, plots in the non-orthogonal system are still available, as Figure 5 verifies.
|
Figure 5 Grid lines for a non-orthogonal system added to Maple
|
|
|
|
Return to Index for Example Worksheets
|