 linalg(deprecated)/diverge - Maple 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}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}{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, v, v with unit vectors a, a, a, and scale factors h, h, h. 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*h*h)*sum(diff(h*h*h* 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≔\mathrm{vector}\left(\left[x,{y}^{2},z\right]\right):$$v≔\mathrm{vector}\left(\left[x,y,z\right]\right):$
 > $\mathrm{diverge}\left(f,v\right)$
 ${2}{+}{2}{}{y}$ (1)
 > $h≔\mathrm{vector}\left(\left[r,\mathrm{sin}\left(\mathrm{\theta }\right),z\right]\right):$$v≔\mathrm{vector}\left(\left[r,\mathrm{\theta },z\right]\right):$
 > $\mathrm{diverge}\left(h,v,\mathrm{coords}=\mathrm{cylindrical}\right)$
 $\frac{{3}{}{r}{+}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right)}{{r}}$ (2)
 > $i≔\mathrm{vector}\left(\left[r,\mathrm{sin}\left(\mathrm{\theta }\right)r,\mathrm{cos}\left(\mathrm{\phi }\right)r\right]\right):$$v≔\mathrm{vector}\left(\left[r,\mathrm{\theta },\mathrm{\phi }\right]\right):$
 > $\mathrm{diverge}\left(i,v,\mathrm{coords}=\mathrm{spherical}\right)$
 $\frac{{2}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){}{\mathrm{cos}}{}\left({\mathrm{\theta }}\right){+}{3}{}{\mathrm{sin}}{}\left({\mathrm{\theta }}\right){-}{\mathrm{sin}}{}\left({\mathrm{\phi }}\right)}{{\mathrm{sin}}{}\left({\mathrm{\theta }}\right)}$ (3)

define the scale factors in spherical coordinates

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