linalg(deprecated)/diverge - Help

linalg(deprecated)

 diverge
 divergence of a vector function

 Calling Sequence diverge(f, v) diverge(f, v, co)

Parameters

 f - vector or list of expressions v - vector or list (same length as f) of the variables of f co - (optional), is either of type = or a list of three elements. This option is used to compute the divergence in orthogonally curvilinear coordinate systems.

Description

 • Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[Divergence], instead.
 - For information on migrating linalg code to the new packages, see examples/LinearAlgebraMigration.
 • The function diverge computes the divergence of f with respect to v, where f is a vector function of the variables given by v.
 • The divergence of f with respect to v is defined as the sum of $\frac{\partial }{\partial {v}_{i}}{f}_{i}$ as i ranges over the length of f.
 • In the case of three dimensions, where f is a three-dimensional function of three variables and v is a list or a vector of three variables:
 If the optional third argument co is of the form coords = coords_name or coords = coords_name([const]), diverge will operate on commonly used orthogonally curvilinear coordinate systems. See ?coords for the list of the coordinate systems supported by Maple.

 For orthogonally curvilinear coordinates v[1], v[2], v[3] with unit vectors a[1], a[2], a[3], and scale factors h[1], h[2], h[3]. Let the rectangular coordinates x, y, z be defined in terms of the specified orthogonally curvilinear coordinates. We have: h[n]^2 = [diff(x,v[n])^2 + diff(y,v[n])^2 + diff(z,v[n])^2], n=1,2,3. The formula for the divergence of f is: diverge(f) = 1/(h[1]*h[2]*h[3])*sum(diff(h[1]*h[2]*h[3]* f[n]/h[n],v[n]),n=1..3)

 If the optional third argument co is a list of three elements which specify the scale factors, diverge will operate on orthogonally curvilinear coordinate systems.
 To compute the divergence in other orthogonally curvilinear coordinate systems, use the addcoords routine.
 • The two dimensional case is similar to the three dimensional one.
 • The command with(linalg,diverge) allows the use of the abbreviated form of this command.

Examples

Important: The linalg package has been deprecated. Use the superseding command LinearAlgebra[Divergence], instead.

 > $\mathrm{with}\left(\mathrm{linalg}\right):$
 > $f≔\left[\begin{array}{ccc}x& {y}^{2}& z\end{array}\right]:$$v≔\left[\begin{array}{ccc}x& y& z\end{array}\right]:$
 > $\mathrm{diverge}\left(f,v\right)$
 ${2}{+}{2}{}{y}$ (1)
 > $h≔\left[\begin{array}{ccc}r& \mathrm{sin}\left(\mathrm{θ}\right)& z\end{array}\right]:$$v≔\left[\begin{array}{ccc}r& \mathrm{θ}& z\end{array}\right]:$
 > $\mathrm{diverge}\left(h,v,\mathrm{coords}=\mathrm{cylindrical}\right)$
 $\frac{{3}{}{r}{+}{\mathrm{cos}}{}\left({\mathrm{θ}}\right)}{{r}}$ (2)
 > $i≔\left[\begin{array}{ccc}r& \mathrm{sin}\left(\mathrm{θ}\right)r& \mathrm{cos}\left(\mathrm{φ}\right)r\end{array}\right]:$$v≔\left[\begin{array}{ccc}r& \mathrm{θ}& \mathrm{φ}\end{array}\right]:$
 > $\mathrm{diverge}\left(i,v,\mathrm{coords}=\mathrm{spherical}\right)$
 $\frac{{2}{}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){}{\mathrm{cos}}{}\left({\mathrm{θ}}\right){+}{3}{}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){-}{\mathrm{sin}}{}\left({\mathrm{φ}}\right)}{{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}$ (3)

define the scale factors in spherical coordinates

 > $s≔\left[1,r,r\mathrm{sin}\left(\mathrm{θ}\right)\right]:$
 > $\mathrm{diverge}\left(i,v,s\right)$
 $\frac{{2}{}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){}{\mathrm{cos}}{}\left({\mathrm{θ}}\right){+}{3}{}{\mathrm{sin}}{}\left({\mathrm{θ}}\right){-}{\mathrm{sin}}{}\left({\mathrm{φ}}\right)}{{\mathrm{sin}}{}\left({\mathrm{θ}}\right)}$ (4)