diff - Maple Help

VectorCalculus

 diff
 computes the derivative of a Vector

 Calling Sequence diff(f, v)

Parameters

 f - Vector(algebraic); Vector or algebraic expression v - name; specify the variables of differentiation

Description

 • The diff(f,v) command is an extension of the top-level diff command which understands free Vectors, position Vectors, rooted Vectors and VectorFields in the different coordinate systems of the VectorCalculus package. If f is not a Vector, the arguments are passed to the top-level diff command.
 • If f is a free Vector, f is differentiated component-wise independent of the coordinate system. The output is a free Vector.
 • If f is a position Vector representing a curve or surface, the Vector is differentiated component-wise since it is in Cartesian coordinates (see Position Vector). The output is a  Vector rooted at the point with the same components as the position Vector.
 • If f is a rooted Vector in non-Cartesian coordinates, f is mapped back to Cartesian coordinates where the differentiation takes place. The output is a Vector rooted at the same point as f.
 • If f is a VectorField in non-Cartesian coordinates, the unit vectors of the coordinate system of the field are expressed in terms of the standard Cartesian unit vectors to perform the differentiation. The result is mapped back to the original coordinate system and a field is returned.

Examples

Differentiating a free Vector.

 > $\mathrm{with}\left(\mathrm{VectorCalculus}\right):$
 > $\mathrm{v1}≔⟨t,{t}^{2},{t}^{3}⟩$
 ${\mathrm{v1}}{≔}\left({t}\right){{e}}_{{x}}{+}\left({{t}}^{{2}}\right){{e}}_{{y}}{+}\left({{t}}^{{3}}\right){{e}}_{{z}}$ (1)
 > $\mathrm{diff}\left(\mathrm{v1},t\right)$
 $\left({1}\right){{e}}_{{x}}{+}\left({2}{}{t}\right){{e}}_{{y}}{+}\left({3}{}{{t}}^{{2}}\right){{e}}_{{z}}$ (2)
 > $\mathrm{v2}≔⟨1,2,3⟩$
 ${\mathrm{v2}}{≔}\left({1}\right){{e}}_{{x}}{+}\left({2}\right){{e}}_{{y}}{+}\left({3}\right){{e}}_{{z}}$ (3)
 > $\mathrm{diff}\left(\mathrm{v2},t\right)$
 $\left({0}\right){{e}}_{{x}}{+}\left({0}\right){{e}}_{{y}}{+}\left({0}\right){{e}}_{{z}}$ (4)

Differentiating a position Vector that represents a curve. The result is a vector rooted at the curve.

 > $\mathrm{pv}≔\mathrm{PositionVector}\left(\left[p,p\right],\mathrm{polar}\left[r,t\right]\right)$
 ${\mathrm{pv}}{≔}\left[\begin{array}{c}{p}{}{\mathrm{cos}}{}\left({p}\right)\\ {p}{}{\mathrm{sin}}{}\left({p}\right)\end{array}\right]$ (5)
 > $\mathrm{dpv}≔\mathrm{diff}\left(\mathrm{pv},p\right)$
 ${\mathrm{dpv}}{≔}\left[\begin{array}{c}{\mathrm{cos}}{}\left({p}\right){-}{p}{}{\mathrm{sin}}{}\left({p}\right)\\ {\mathrm{sin}}{}\left({p}\right){+}{p}{}{\mathrm{cos}}{}\left({p}\right)\end{array}\right]$ (6)
 > $\mathrm{GetRootPoint}\left(\mathrm{dpv}\right)$
 $\left({p}{}{\mathrm{cos}}{}\left({p}\right)\right){{e}}_{{x}}{+}\left({p}{}{\mathrm{sin}}{}\left({p}\right)\right){{e}}_{{y}}$ (7)

Differentiating a rooted Vector gives a Vector rooted at the same root as the original Vector.

 > $\mathrm{rv}≔\mathrm{RootedVector}\left(\left[1,p\right],\mathrm{root}=\left[p,p\right],\mathrm{polar}\left[r,t\right]\right)$
 ${\mathrm{rv}}{≔}\left[\begin{array}{c}{1}\\ {p}\end{array}\right]$ (8)
 > $\mathrm{drv}≔\mathrm{diff}\left(\mathrm{rv},p\right)$
 ${\mathrm{drv}}{≔}\left[\begin{array}{c}\frac{{p}{}{\mathrm{cos}}{}\left({p}\right){}\left({-}{2}{}{\mathrm{sin}}{}\left({p}\right){-}{p}{}{\mathrm{cos}}{}\left({p}\right)\right){+}{p}{}{\mathrm{sin}}{}\left({p}\right){}\left({2}{}{\mathrm{cos}}{}\left({p}\right){-}{p}{}{\mathrm{sin}}{}\left({p}\right)\right)}{\sqrt{{{p}}^{{2}}{}{{\mathrm{sin}}{}\left({p}\right)}^{{2}}{+}{{p}}^{{2}}{}{{\mathrm{cos}}{}\left({p}\right)}^{{2}}}}\\ \frac{{p}{}{\mathrm{cos}}{}\left({p}\right){}\left({2}{}{\mathrm{cos}}{}\left({p}\right){-}{p}{}{\mathrm{sin}}{}\left({p}\right)\right){-}{p}{}{\mathrm{sin}}{}\left({p}\right){}\left({-}{2}{}{\mathrm{sin}}{}\left({p}\right){-}{p}{}{\mathrm{cos}}{}\left({p}\right)\right)}{\sqrt{{{p}}^{{2}}{}{{\mathrm{sin}}{}\left({p}\right)}^{{2}}{+}{{p}}^{{2}}{}{{\mathrm{cos}}{}\left({p}\right)}^{{2}}}}\end{array}\right]$ (9)
 > $\mathrm{simplify}\left(\mathrm{drv}\right)\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}\mathbf{assuming}\phantom{\rule[-0.0ex]{0.3em}{0.0ex}}0
 $\left[\begin{array}{c}{-}{p}\\ {2}\end{array}\right]$ (10)
 > $\mathrm{GetRootPoint}\left(\mathrm{rv}\right)$
 $\left({p}\right){{e}}_{{r}}{+}\left({p}\right){{e}}_{{t}}$ (11)
 > $\mathrm{pv}≔\mathrm{PositionVector}\left(\left[1,t,{t}^{2}\right],\mathrm{cartesian}\left[x,y,z\right]\right)$
 ${\mathrm{pv}}{≔}\left[\begin{array}{c}{1}\\ {t}\\ {{t}}^{{2}}\end{array}\right]$ (12)
 > $\mathrm{tv}≔\mathrm{diff}\left(\mathrm{pv},t\right)$
 ${\mathrm{tv}}{≔}\left[\begin{array}{c}{0}\\ {1}\\ {2}{}{t}\end{array}\right]$ (13)
 > $\mathrm{dtv}≔\mathrm{diff}\left(\mathrm{tv},t\right)$
 ${\mathrm{dtv}}{≔}\left[\begin{array}{c}{0}\\ {0}\\ {2}\end{array}\right]$ (14)
 > $\mathrm{GetRootPoint}\left(\mathrm{dtv}\right)$
 $\left({1}\right){{e}}_{{x}}{+}\left({t}\right){{e}}_{{y}}{+}\left({{t}}^{{2}}\right){{e}}_{{z}}$ (15)

Differentiating a VectorField gives another VectorField.

 > $F≔\mathrm{VectorField}\left(⟨ar,0,0⟩,\mathrm{spherical}\left[r,\mathrm{\phi },\mathrm{\theta }\right]\right)$
 ${F}{≔}\left({a}{}{r}\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({0}\right){\stackrel{{_}}{{e}}}_{{\mathrm{φ}}}{+}\left({0}\right){\stackrel{{_}}{{e}}}_{{\mathrm{θ}}}$ (16)
 > $\mathrm{diff}\left(F,\mathrm{\phi }\right)$
 $\left({a}{}{r}{}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{{\mathrm{cos}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){+}{a}{}{r}{}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right){}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){-}{a}{}{r}{}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right){}{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({a}{}{r}{}{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}^{{2}}{}{{\mathrm{cos}}{}\left({\mathrm{\theta }}\right)}^{{2}}{+}{a}{}{r}{}{{\mathrm{cos}}{}\left({\mathrm{\phi }}\right)}^{{2}}{}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}^{{2}}{+}{a}{}{r}{}{{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}^{{2}}\right){\stackrel{{_}}{{e}}}_{{\mathrm{φ}}}{+}\left({0}\right){\stackrel{{_}}{{e}}}_{{\mathrm{θ}}}$ (17)
 > $W≔\mathrm{VectorField}\left(⟨f\left(r,t\right),g\left(r,t\right)⟩,\mathrm{polar}\left[r,t\right]\right)$
 ${W}{≔}\left({f}{}\left({r}{,}{t}\right)\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({g}{}\left({r}{,}{t}\right)\right){\stackrel{{_}}{{e}}}_{{t}}$ (18)
 > $\mathrm{simplify}\left(\mathrm{diff}\left(W,r\right)\right)$
 $\left(\frac{{\partial }}{{\partial }{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({r}{,}{t}\right)\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left(\frac{{\partial }}{{\partial }{r}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{g}{}\left({r}{,}{t}\right)\right){\stackrel{{_}}{{e}}}_{{t}}$ (19)
 > $\mathrm{simplify}\left(\mathrm{diff}\left(W,t\right)\right)$
 $\left(\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{f}{}\left({r}{,}{t}\right){-}{g}{}\left({r}{,}{t}\right)\right){\stackrel{{_}}{{e}}}_{{r}}{+}\left({f}{}\left({r}{,}{t}\right){+}\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{g}{}\left({r}{,}{t}\right)\right){\stackrel{{_}}{{e}}}_{{t}}$ (20)