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.
> | ![]() |
> | ![]() |
Trying to take the divergence of when it is defined as an array doesn't work, as we can see above. However, if we define
in one of the two ways shown below, the divergence operation does function properly.
> | ![]() |
> | ![]() |
This does work; the answer is 0 as expected.
> | ![]() |
> | ![]() |
The definition of above also worked as expected. Below, the components of the velocity vector v are defined as some unknown function of x, y and z.
> | ![]() |
Let's see what looks like.
> | ![]() |
For use later on with the operation CrossProduct or &x we will define the following vector field
> | ![]() |