next up previous
Next: Maple functions from the Up: Background Previous: Maple functions from the

Examples

  > with(linalg):

Warning: new definition for   norm
Warning: new definition for   trace

  > with(CalcP):

  > u := vector([1,2,3]);

displaymath294

  > f := t-> vector([t,t^2,t^3]);

displaymath295

  > g := t -> vector([cos(t),sin(t),t]);

displaymath296

  > h := t -> vector([cos(t),sin(2*t)]);

displaymath297

To add vectors, or multiply them by scalars, you can use the Maple add and scalarmul commands, or use standard math notation and use the evalm command.

  > add(u,g(t));

displaymath298

  > evalm(t^4*u+2*f(t)-g(t));

displaymath299

  > scalarmul(u,t^2);

displaymath300

The individual components of a vector are also available in Maple, as shown below. You can use this to extract the individual functions for plotting or further manipulation.

  > u[3];

displaymath301

  > f(t)[1];

displaymath302

  > g(t)[2];

displaymath303

The linalg package has procedures for the dot product and the cross product. The latter procedure, however, works only on vectors with three components and the former procedure requires two vectors with the same number of components, so beware. Some examples are shown below.

  > dotprod(u,f(t));

displaymath304

  > crossprod(u,g(t));

displaymath305

  > crossprod(f(t),g(t));

displaymath306



Sean O Anderson
Tue Mar 25 09:42:50 EST 1997