Vectors
The VectorCalculus packages support the data structures shown in Table 1.
Free vector

> 


PositionVector

> 


RootedVector

> 


VectorField

> 


Table 1 The four types of vectors in the VectorCalculus packages

The data structures provided in the VectorCalculus packages are richer and more complex than the structures in the LinearAlgebra packages. The fundamental light illuminating the VectorCalculus packages is the identification of the Cartesian point with the vector . This identification is obvious and harmless in the Cartesian plane, but is not possible in nonCartesian coordinates. Any confusion users have with the VectorCalculus packages in Maple generally stems from failing to see that this identification of point and vector is valid only in Cartesian coordinates.
Before clarifying the distinctions between these four data structures, we make the following observations.
 Each of these four data structures carries, as an attribute, a coordinate system, and where applicable, the names of the coordinate variables.
 The default system is Cartesian, but names for the coordinate variables are not set by default.
 The SetCoordinates command defines an ambient (or background) coordinate system.
 The BasisFormat command can be used to suppress the explicit display of basis vectors.
 The About command provides information inherent in one of these data structures.
 The MapToBasis command changes coordinates in these data structures.
Free Vector
The default coordinate system is Cartesian, but the names of the coordinate variables are not set by default. Thus, for the free vector
> 

we have
> 

Vector[column](2, {(1) = x, (2) = y}, datatype = anything, storage = rectangular, order = Fortran_order, attributes = [coords = cartesian], shape = []) 
or better still,
> 

The free vector V represents the Cartesian point and is identified with the arrow from the origin of the Cartesian plane to the point . This identification of point and arrow is both common and innocuous in the Cartesian plane.
The basis vectors and are essentially the more familiar and . These basis vectors can be suppressed via
> 

in which case the free vector is displayed as a column vector:
> 

The free vector can be constructed as a row vector with the syntax
> 

Its nature as a row vector can be verified with
> 

Vector[row](2, {(2) = v, (1) = u}, datatype = anything, storage = rectangular, order = Fortran_order, attributes = [coords = cartesian], shape = []) 
In the VectorCalculus packages, the period (dot) is strictly the inner (or dot) product operator. There is no recognition of an outer product in these packages, as we verify with the equivalent calculations
> 

The VectorCalculus packages do not have a transpose operator. If the Transpose command from the LinearAlgebra package is applied to V, we get the row vector
> 

but U is now a "LinearAlgebra" vector and has lost the attribute containing the coordinate information, as we see with
> 

Vector[row](2, {(1) = x, (2) = y}, datatype = anything, storage = rectangular, order = Fortran_order, shape = []) 
The MapToBasis command is used to change coordinates. When applied to a free vector, it merely changes coordinates as for a point, and not for a vector. Thus, the contravariant law for changing coordinates in a vector is not applied to the free vector.
To illustrate, change the free vector V to polar coordinates, obtaining
> 

The Cartesian point has become the polar point No change of base vectors has occurred.
In terms of explicit "basis vectors," we would have
> 

The symbols and are not covariantly transformed basis vectors. They merely indicate the coordinate system in which to interpret what are essentially coordinates of a point. The identification of the point with the vector holds only in the Cartesian plane. It does not extend to nonCartesian coordinates.
One might think of a rectangular frame in which the coordinate axes represent (horizontally) and (vertically). When the transformation from Cartesian to polar coordinates is interpreted as a mapping, the Cartesian point is physically mapped onto the polar point that resides in the rectangular plane. When the transformation from Cartesian to polar coordinates is interpreted as a change of coordinates, the Cartesian point remains fixed, but its address is changed to conform to the coordinates imposed by the concentric circles and radial lines pulled back to the Cartesian plane from the "polar" plane.
Figure 1 illustrates a simple experiment in which MapToBasis is applied to the Cartesian free vector . After conversion to polar coordinates, the "vector" retains its correspondence with the point to which it is drawn. The transformed "vector," graphed via the PlotVector command, appears unchanged.
> 


Figure 1 MapToBasis applied to the free vector

PositionVector
Curves and surfaces embedded in a Cartesian space are often described with the radiusvector notation
or
Consequently, the VectorCalculus packages provide the PositionVector command. For example, the parabola given parametrically by is captured with
> 

The PositionVector always echoes as a column vector, and always represents a vector in Cartesian coordinates. By means of the PlotPositionVector command, Figure 2 provides a graph of the resulting curve.
> 


Figure 2 Graph of a curve described in radiusvector notation

The PlotPositionVector command will also graph various vector fields along the curve. On the graph in Figure 2, Figure 3 superimposes unit tangent vectors (in blue) and principal normal vectors (in green).
> 


Figure 3 Unit tangent and principal normal vectors along the parabola in Figure 2

On the graph in Figure 2, Figure 4 superimposes the vectors and
> 


Figure 4 Vectors and along the parabola in Figure 2

The cardioid is captured by the PositionVector construct via
> 

The coordinate parameter in the PositionVector command indicates the coordinate system in which the parametric representation is to be interpreted. The resulting vector is a Cartesian vector. Figure 5 shows a graph of this cardioid.
> 


Figure 5 Cardioid captured as a PositionVector

RootedVector
In a Cartesian space, parallel translation of vectors is taken for granted. For example, the vector actually has its tail at the origin, and its head at the point . This vector can always be thought of as the same arrow with its tail at an arbitrary point in the Cartesian plane. In nonCartesian coordinates, we lose the construct of the position vector emanating from the origin. Vectors are arrows with their tails at different points in the underlying Cartesian space, but are expressed in terms of the curvilinear basis vectors that change from point to point.
The Maple construct for "attaching" a vector to a point is the RootedVector. The vector
> 

is attached to the root point as we verify in Figure 6.
> 


Figure 6 The vector translated to the root point

Note that the RootedVector is always displayed as a column vector, and is of type RootedVector, as we seem from
> 

An arrow of length one and pointing in the radial direction of polar coordinates is attached to the polar point with the following syntax.
> 

Figure 7 verifies that the vector W, drawn in the Cartesian plane, is the correct polar vector.
> 


Figure 7 Unit radial vector attached to the polar point but drawn in the underlying Cartesian plane

For another example of a RootedVector in polar coordinates, change coordinates in the vector to obtain
> 

Its root point becomes the root point as we verify with
> 

The components are with respect to the unit basis vectors (tangent to the coordinate curves) at the root point. Figure 8 provides graphical evidence that the transformed vector determines the same arrow as seen in Figure 6.
> 


Figure 8 The vector transformed to polar coordinates

The calculations leading to Figure 8 can be verified as follows. First, define the curvilinear coordinate lines of polar coordinates by the PositionVector
> 

Unit tangent vectors along the coordinate curves are given by
> 

Evaluate these basis vectors at the point to obtain
> 

The components of the vector are the coefficients of the linear combination
> 

Hence, we have recovered the vector .
VectorField
A vector field is a function F from to . This function is sometimes described as a vectorvalued function of a vector argument, and is denoted by . In simpler terms, the vector field provides a recipe for attaching an arrow to every point in a region of . Maple provides the VectorField construct, exemplified via
> 

The default display (with BasisFormat set to true) includes the moving basis vectors, here, and . In Cartesian coordinates, these vectors are nothing more than and . However, there is a fundamental difference between these overbarred vectors, and the unbarred "basis vectors" used in the display of a free vector. Once again, we remind the reader that the free vector is merely notation for a point, and is equivalent to an arrow only in Cartesian coordinates. In nonCartesian coordinates, the unbarred "basis vector" of the free vector is merely notation for a point.
The overbarred basis vectors of the VectorField are the moving (unit) basis vectors in both Cartesian and nonCartesian coordinates. Conceptually, they are functions of position, but in Maple it takes the RootedVector construct to express the positional dependency of any vector.
If we set
> 

the vector field F will be displayed as a column vector, as we see from
> 

The VectorField carries as attribute, both "vectorfield" and its coordinate system, as we see with
> 

Vector[column](2, {(1) = x*y, (2) = x+y}, datatype = anything, storage = rectangular, order = Fortran_order, attributes = [vectorfield, coords = cartesian[x, y]], shape = []) 
The MapToBasis command applies the contravariant transformation law to a VectorField, correctly transforming the vectors in the field from one coordinate system to another. For example, if the field F is transformed to polar coordinates, we would obtain
> 

When the field is displayed as a column vector, the basis vectors and must be inferred. They can be made visible by
> 

Evaluation of the VectorField results in a RootedVector, with the evaluation point becoming the root point. For example, we would have
> 

The vector is a RootedVector, as we see from
> 

The components are the coefficients of the moving basis vectors and evaluated at the root point the polar representation of the Cartesian point . The evalVF command uses the free vector notation for the evaluation point, and this point is interpreted in the ambient coordinate system
> 

The ambient coordinate system can be set with
> 

in which case we would have obtained
> 

The root point for the vector is given by
> 

so that it is now
Differential Operators
The differential operators Divergence and Curl act on VectorFields, the first returning a scalar field; the second, a VectorField. The differential operator Gradient acts on a scalar field and returns a VectorField, whereas the operator Laplacian maps a scalar field to a scalar field.
While there is a special data structure for the vector field, there is no structure provided for the scalar field. These are instead given by ordinary Maple expressions, and as such, cannot carry the attribute of coordinate system.
We next give examples of the behavior of the four differential operators of vector calculus, using the field
> 

Error, (in VectorCalculus:Vector[column]) Vector has incorrect dimension for polar[r, theta] coordinates: try changing the default coordinates 
The Error can be explained as follows. Recall that earlier, the ambient coordinate system was set to polar, as we see from
> 

There are then two options: use the SetCoordinates command to change the ambient system, or force the issue by defining the vector
> 

then writing
> 

The curl of F can be computed by the command
> 

or by the notation
> 

In either case, the barred basis vectors indicate that the curl is again a VectorField.
The divergence of F can be computed by the command
> 

or by the notation
> 

The gradient of the scalar field
> 

can be computed by the command
> 

The barred basis vectors indicate that this result is a VectorField. Here, it is essential to include the name of the coordinate system in the Gradient command since the ambient system is not the one governing the variables in .
A similar remark applies to the computation of the Laplacian, given by
> 

If the ambient coordinate system is changed to
> 

the gradient and Laplacian, respectively, could have been computed with the commands
> 

and
> 

or with the notation
> 

and
> 

Velocity and Acceleration in Polar Coordinates
Determining expressions for the velocity and acceleration vectors in nonCartesian coordinates is a typical task in mechanics. To obtain these expressions in polar coordinates, recall
> 

as representations of the moving (or local) unit basis vectors in polar coordinates. Introduce the symbols and in place of the basis vectors i and j, and write as
> 

Next, express i and j in terms of the vectors and , where, to avoid name clashes, use the symbols and .
> 

Write the position vector as
> 

and differentiate with respect to to obtain
> 

Replace the implied basis vectors i and j with their equivalents in terms of and , obtaining
> 

Similarly, to obtain the acceleration vector, differentiate the position vector twice, obtaining
> 

then replace the basis vectors i and j to obtain
> 
