differentiate expressions taking into account the geometrical relations between curvilinear unit vectors and coordinates of different types - Maple Programming Help

Home : Support : Online Help : Physics : Vectors : Physics/Vectors/diff

Physics[Vectors][diff] - differentiate expressions taking into account the geometrical relations between curvilinear unit vectors and coordinates of different types

 Calling Sequence diff(A, x1, x2, ...)

Parameters

 A - an algebraic expression x1, x2, ... - names or functions representing the differentiation variables geometricdifferentiation, - optional, default value is true, to take into account the geometrical relation between curvilinear coordinates and unit vectors even after setting this option to false using Setup.

Description

 • The diff command of Vectors is the same as the diff command of Physics, but for two additional things:
 1 it will take into account the geometrical relation between cartesian, cylindrical and spherical coordinates, as well as the coordinate dependence of curvilinear unit vectors. Example: $x=\mathrm{\rho }\mathrm{cos}\left(\mathrm{\phi }\right)$, so diff(x, rho) returns $\mathrm{cos}\left(\mathrm{\phi }\right)$ even when has(x, rho) returns false.
 2 it will take into account any functional dependency of the geometrical coordinates and unit vectors found in the derivand. Example: when the derivand has $x\left(t\right)$ the formula used is $x\left(t\right)=\mathrm{\rho }\left(t\right)\mathrm{cos}\left(\mathrm{\phi }\left(t\right)\right)$ so diff(x(t), rho) (also diff(x(t), rho(t))) returns $\mathrm{cos}\left(\mathrm{\phi }\left(t\right)\right)$.
 Although taking into account relations between geometrical coordinates, unit vectors and their functional dependency, is natural when working with vectors, you can turn OFF these two differences between Physics[Vectors][diff] and Physics[diff] using the Setup command, entering Setup(geometricdifferentiation = false). In such a case you can still differentiate taking into account the geometrical relation between curvilinear coordinates unit vectors by passing the optional argument geometricdifferentiation.
 The %diff is the inert form of diff, that is: it represents the same mathematical operation while holding the operation unperformed. To activate the operation use value.
 • The result of diff is always expressed in the coordinate system of the differentiation variable. When that is ambiguous (e.g. $z$ may be cartesian or cylindrical), the ambiguity is resolved looking at the derivand, whether it is a cartesian or cylindrical vector, and when it is neither, then cartesian coordinates are used. The same approach is used when the differentiation variable is $\mathrm{\phi }$, that could be cylindrical or spherical.
 • In the derivand, the cylindrical and spherical coordinates and related unit vectors can have functional dependency, say as in $\mathrm{\rho }\left(t\right)$, or for a unit vector, $\mathrm{_ρ}\left(\mathrm{\phi }\left(t\right)\right)$, and the differentiation variables can be names or functions, as it is the case when using the Physics[diff] command. This permits computing things for instance like $\frac{ⅆ}{ⅆt}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{_ρ}\left(\mathrm{\phi }\left(t\right)\right)$ taking into account that $\frac{\partial }{\partial \mathrm{\phi }}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{_ρ}=\mathrm{_φ}$.
 • The computation of diff(A, q) is performed as follows.
 If $q$ does not belong to $\left\{\mathrm{\phi },r,\mathrm{\rho },\mathrm{\theta },x,y,z\right\}$ (the geometrical coordinates - see conventions), then send the task to Physics[diff] returning $\mathrm{Physics}:-\mathrm{diff}\left(a,q\right)$.
 Otherwise,  if $A$ is a projected vector then
 1 $A$ is reprojected in the cartesian orthonormal basis (using ChangeBasis), where unit vectors are constant;
 2 a change of variables if performed on the components of $A$ (using dchange), in order to express $A$ in the coordinate system to which $q$ belongs;
 3 the differentiation is performed using the standard Physics[diff];
 4 the result is reprojected into the original orthonormal basis and returned.
 If $A$ is a non-projected vector or a scalar function, the task is restricted to steps 2. and 3. above.
 • For the conventions about the geometrical coordinates and vectors see Identify

Examples

 > $\mathrm{with}\left({\mathrm{Physics}}_{\mathrm{Vectors}}\right)$
 $\left[{\mathrm{&x}}{,}{\mathrm{+}}{,}{\mathrm{.}}{,}{\mathrm{ChangeBasis}}{,}{\mathrm{ChangeCoordinates}}{,}{\mathrm{Component}}{,}{\mathrm{Curl}}{,}{\mathrm{DirectionalDiff}}{,}{\mathrm{Divergence}}{,}{\mathrm{Gradient}}{,}{\mathrm{Identify}}{,}{\mathrm{Laplacian}}{,}{\nabla }{,}{\mathrm{Norm}}{,}{\mathrm{Setup}}{,}{\mathrm{diff}}\right]$ (1)
 > $\mathrm{Setup}\left(\mathrm{mathematicalnotation}=\mathrm{true}\right)$
 $\left[{\mathrm{mathematicalnotation}}{=}{\mathrm{true}}\right]$ (2)

 > $R≔\mathrm{_ρ}$
 ${R}{≔}\stackrel{{\wedge }}{{\mathrm{\rho }}}$ (3)
 > $\frac{\partial }{\partial x}R$
 ${-}\frac{{y}{}\stackrel{{\wedge }}{{\mathrm{\phi }}}}{{{x}}^{{2}}{+}{{y}}^{{2}}}$ (4)
 > $\frac{\partial }{\partial y}R$
 $\frac{{x}{}\stackrel{{\wedge }}{{\mathrm{\phi }}}}{{{x}}^{{2}}{+}{{y}}^{{2}}}$ (5)
 > $\frac{\partial }{\partial z}R$
 ${0}$ (6)

Note the difference when you change the order in which derivatives are computed in a 2nd order derivative

 > $\frac{{\partial }^{2}}{\partial \mathrm{ρ}\partial x}x$
 ${0}$ (7)
 > $\mathrm{simplify}\left(\frac{{\partial }^{2}}{\partial x\partial \mathrm{ρ}}x\right)$
 $\frac{{{y}}^{{2}}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}\right)}^{{3}}{{2}}}}$ (8)

Curvilinear coordinates and related unit vectors can have functional dependency, and so can the differentiation variable. Consider for instance the radial unit vector $\stackrel{\wedge }{\mathrm{\rho }}$ in cylindrical coordinates as a function of the polar angle $\mathrm{\phi }$ which in turn is a function of $t$

 > $\mathrm{_ρ}\left(\mathrm{φ}\left(t\right)\right)$
 $\stackrel{{\wedge }}{{\mathrm{\rho }}}{}\left({\mathrm{\phi }}{}\left({t}\right)\right)$ (9)

The derivative with respect to $\mathrm{\phi }\left(t\right)$ takes into account the geometrical dependency of $\stackrel{\wedge }{\mathrm{\rho }}$ with respect to $\mathrm{\phi }$, while keeping, in the result, the dependency with respect to $t$ of the derivand

 > $\mathrm{diff}\left(,\mathrm{φ}\left(t\right)\right)$
 $\stackrel{{\wedge }}{{\mathrm{\phi }}}{}\left({t}\right)$ (10)

The derivative of  $\stackrel{\wedge }{\mathrm{\rho }}\left(\mathrm{\phi }\left(t\right)\right)$ with respect to $t$ uses the chain rule taking the result above into account, hence

 > $\frac{\partial }{\partial t}$
 $\stackrel{{\wedge }}{{\mathrm{\phi }}}{}\left({t}\right){}\stackrel{{\mathbf{.}}}{{\phi }}{}\left({t}\right)$ (11)

You can turn OFF geometric differentiation using Setup

 > $\mathrm{Setup}\left(\mathrm{geom}=\mathrm{false}\right)$
 $\mathrm{* Partial match of \text{'}}\mathrm{geom}\mathrm{\text{'} against keyword \text{'}}\mathrm{geometricdifferentiation}\text{'}$
 $\mathrm{_______________________________________________________}$
 $\left[{\mathrm{geometricdifferentiation}}{=}{\mathrm{false}}\right]$ (12)

So now, for example, the differentiation above returns

 > $\frac{\partial }{\partial t}$
 ${\mathrm{D}}{}\left(\stackrel{{\wedge }}{{\mathrm{\rho }}}\right){}\left({\mathrm{\phi }}{}\left({t}\right)\right){}\stackrel{{\mathbf{.}}}{{\phi }}{}\left({t}\right)$ (13)

and differentiating $\stackrel{\wedge }{\mathrm{\rho }}$ with respect to x returns 0 instead of eq.(4)

 > $\frac{\partial }{\partial x}R$
 ${0}$ (14)

You can still use geometric differentiation by passing the optional argument geometricdifferentiation

 > $\mathrm{diff}\left(R,x,\mathrm{geometricdifferentiation}\right)$
 ${-}\frac{{y}{}\stackrel{{\wedge }}{{\mathrm{\phi }}}}{{{x}}^{{2}}{+}{{y}}^{{2}}}$ (15)
 > 

Compatibility

 • The Physics[Vectors][diff] command was introduced in Maple 17.