We compute the curl and divergence of a vector field and compute the gradient of a function using Maple. These commands are also in the linalg package.
with(linalg): f := vector( [ x^2-2*y*z, y^3+3*x*z, z^2 + x*y ] ); f is the vector field v := vector( [x,y,z] ); x,y,z the independent variables curl(f, v); curl of the vector field f diverge(f, v); divergence of the vector field f p := x^2 + y^3*z^2 ; a function of x,y,z grad(p, v); gradient of p
Once can also plot two and three dimensional vector fields using commands
in the plots package. To plot the two dimensional vector field
over the range -2<x,y<2, use
with(plots): with(linalg): f := vector( [y, sin(x) + y/10] ); fieldplot( f, x=-2..2, y=-2..2 );The arrows point in the direction of vector field and the size of the arrows reflects the magnitude of the vector field. Three dimensional vector fields may be drawn using the
fieldplot3d
command in the plots package but the picture is not very
illuminating.