convert/PhysicsVectors - Help

convert/PhysicsVectors

Converts vectors of one of the VectorCalculus and Physics:-Vectors packages to the format of the other package

 Calling Sequence convert(V, PhysicsVectors) convert(V, VectorCalculus)

Parameters

 V - a vector of the VectorCalculus or Physics:-Vectors packages

Description

 • The convert/PhysicsVectors and convert/VectorCalculus routines convert vectors of one of the VectorCalculus or Physics:- Vectors packages into a vector of the other one.
 • According to the conventions of the Physics[Vectors] package, the conversion of one of its vectors to the VectorCalculus package always returns a VectorField.

Examples

 > $\mathrm{with}\left(\mathrm{VectorCalculus}\right):$$\mathrm{with}\left({\mathrm{Physics}}_{\mathrm{Vectors}}\right):$

In the context of the Physics[Vectors] package, vectors are standard algebraic type expressions where the unit vectors are distinguished from the components with an underscore. This is the position vector in cartesian coordinates and cartesian orthonormal basis

 > $R≔x\mathrm{_i}+y\mathrm{_j}+z\mathrm{_k}$
 ${R}{≔}{x}{}{\mathrm{_i}}{+}{y}{}{\mathrm{_j}}{+}{z}{}{\mathrm{_k}}$ (1)
 > $\mathrm{type}\left(R,\mathrm{algebraic}\right)$
 ${\mathrm{true}}$ (2)

In the context of the VectorCalculus package, vectors are formed using a special non-algebraic type structure, although their display looks like an algebraic structure. To convert $R$ above into a vector of the VectorCalculus package use

 > $\mathrm{R2}≔\mathrm{convert}\left(R,\mathrm{VectorCalculus}\right)$
 ${\mathrm{R2}}{≔}\left({x}\right){\stackrel{{_}}{{e}}}_{{x}}{+}\left({y}\right){\stackrel{{_}}{{e}}}_{{y}}{+}\left({z}\right){\stackrel{{_}}{{e}}}_{{z}}$ (3)
 > $\mathrm{type}\left(\mathrm{R2},\mathrm{algebraic}\right)$
 ${\mathrm{false}}$ (4)

To see the structure behind R2 not of algebraic type use

 > $\mathrm{lprint}\left(\mathrm{R2}\right)$
 Vector[row](3,{1 = x, 2 = y, 3 = z},datatype = anything,storage = rectangular,order = Fortran_order,attributes = [vectorfield, coords = cartesian[x,y,z]],shape = [])

To convert back to a vector of the Physics[Vectors] package use

 > $\mathrm{R3}≔\mathrm{convert}\left(\mathrm{R2},\mathrm{PhysicsVectors}\right)$
 ${\mathrm{R3}}{≔}{x}{}{\mathrm{_i}}{+}{y}{}{\mathrm{_j}}{+}{z}{}{\mathrm{_k}}$ (5)
 > $\mathrm{lprint}\left(\mathrm{R3}\right)$
 _i*x+_j*y+_k*z
 > $\mathrm{evalb}\left(\mathrm{R3}=R\right)$
 ${\mathrm{true}}$ (6)