Constructing Vectors and Vector Fields 

I will now create the velocity vector, with components specified by unit vectors in the cartesian coordinate system.  Note: using the function vector() instead of Vector() or <> will result in an array instead of a vector.  In effect, this means that unit vector directions will not be stored with the components, and vector calculus operations will not work properly.  I will demonstrate this difference by creating a vector of ones. 

 

> delta := vector([1, 1, 1]); 1
 

delta := Vector[row](%id = 147450688) 

> Typesetting:-delayDotProduct(VectorCalculus:-Del, delta); 1
 

`.`(VectorCalculus:-Del, delta) 

 

Trying to take the divergence of delta when it is defined as an array doesn't work, as we can see above.  However, if we define delta in one of the two ways shown below, the divergence operation does function properly. 

 

> delta := Vector([1, 1, 1]); 1
 

(Typesetting:-mprintslash)([delta := Vector[column]([[1], [1], [1]], [ 

> Typesetting:-delayDotProduct(VectorCalculus:-Del, delta); 1
 

0 

 

This does work; the answer is 0 as expected. 

 

> delta := `<,>`(1, 1, 1); 1
 

(Typesetting:-mprintslash)([delta := Vector[column]([[1], [1], [1]], [ 

> Typesetting:-delayDotProduct(VectorCalculus:-Del, delta); 1
 

0 

 

The definition of delta above also worked as expected.  Below, the components of the velocity vector v are defined as some unknown function of x, y and z. 

 

> v := proc (x, y, z) options operator, arrow; Vector([vx(x, y, z), vy(x, y, z), vz(x, y, z)]) end proc; 1
 

(Typesetting:-mprintslash)([v := proc (x, y, z) options operator, arrow; (VectorCalculus:-Vector)([vx(x, y, z), vy(x, y, z), vz(x, y, z)]) end proc], [proc (x, y, z) options operator, arrow; (VectorCa...
(Typesetting:-mprintslash)([v := proc (x, y, z) options operator, arrow; (VectorCalculus:-Vector)([vx(x, y, z), vy(x, y, z), vz(x, y, z)]) end proc], [proc (x, y, z) options operator, arrow; (VectorCa...
 

 

Let's see what v(x, y, z) looks like. 

 

> v(x, y, z); 1
 

(Typesetting:-mprintslash)([Vector[column]([[vx(x, y, z)], [vy(x, y, z)], [vz(x, y, z)]], [ 

 

For use later on with the operation CrossProduct or &x we will define the following vector field 

 

> vVectorField := proc (x, y, z) options operator, arrow; VectorField(v(x, y, z)) end proc; 1
 

(Typesetting:-mprintslash)([vVectorField := proc (x, y, z) options operator, arrow; (VectorCalculus:-VectorField)(v(x, y, z)) end proc], [proc (x, y, z) options operator, arrow; (VectorCalculus:-Vecto...