VectorCalculus - Maple Programming Help

Home : Support : Online Help : Mathematics : Vector Calculus : VectorCalculus/Hessian

VectorCalculus

 Hessian
 computes the Hessian Matrix of a function from R^n to R

 Calling Sequence Hessian(f, v, det, opts) Hessian(f, v=p, det, opts)

Parameters

 f - algebraic expression v - (optional) list(name); specify the variables of differentiation p - (optional) list(algebraic); point at which the Hessian is evaluated det - (optional); equation of the form determinant = true or false; specify whether to return the determinant (default: determinant = false) opts - (optional) equation(s) of the form option=value; options passed on to the constructed Matrix

Description

 • The Hessian(f, v) command computes the Hessian Matrix of the function f with respect to the variables in v. This is the Matrix with an (i,j)th entry of diff(f, v[i], v[j]).
 • If v is not provided, the differentiation variables are determined from the ambient coordinate system (see SetCoordinates), if possible.
 • If p is supplied, the computed Hessian matrix will be evaluated at the corresponding point.  The dimension of the point must equal the number of differentiation variables.
 • The det option specifies whether the determinant of the Hessian matrix is also returned.  If given as determinant = true, or just determinant, then an expression sequence containing the Hessian matrix and its determinant is returned.
 • If any options are given in opts, they will be passed on to the construction of the returned Matrix. For details on available options, see Matrix.

Examples

 > $\mathrm{with}\left(\mathrm{VectorCalculus}\right):$
 > $\mathrm{Hessian}\left(\mathrm{cos}\left(xy\right),\left[x,y\right]\right)$
 $\left[\begin{array}{cc}{-}{{y}}^{{2}}{}{\mathrm{cos}}{}\left({x}{}{y}\right)& {-}{\mathrm{sin}}{}\left({x}{}{y}\right){-}{y}{}{x}{}{\mathrm{cos}}{}\left({x}{}{y}\right)\\ {-}{\mathrm{sin}}{}\left({x}{}{y}\right){-}{y}{}{x}{}{\mathrm{cos}}{}\left({x}{}{y}\right)& {-}{{x}}^{{2}}{}{\mathrm{cos}}{}\left({x}{}{y}\right)\end{array}\right]$ (1)
 > $H≔\mathrm{Hessian}\left(\frac{1}{{x}^{2}+{y}^{2}+{z}^{2}},\left[x,y,z\right]\right)$
 ${H}{≔}\left[\begin{array}{ccc}\frac{{8}{}{{x}}^{{2}}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}{-}\frac{{2}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{2}}}& \frac{{8}{}{x}{}{y}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}& \frac{{8}{}{x}{}{z}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}\\ \frac{{8}{}{x}{}{y}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}& \frac{{8}{}{{y}}^{{2}}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}{-}\frac{{2}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{2}}}& \frac{{8}{}{y}{}{z}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}\\ \frac{{8}{}{x}{}{z}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}& \frac{{8}{}{y}{}{z}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}& \frac{{8}{}{{z}}^{{2}}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{3}}}{-}\frac{{2}}{{\left({{x}}^{{2}}{+}{{y}}^{{2}}{+}{{z}}^{{2}}\right)}^{{2}}}\end{array}\right]$ (2)
 > $\mathrm{SetCoordinates}\left(\mathrm{polar}\left[r,t\right]\right):$
 > $\mathrm{Hessian}\left(r\mathrm{cos}\left(t\right),\mathrm{shape}=\mathrm{symmetric},\mathrm{determinant}\right)$
 $\left[\begin{array}{cc}{0}& {-}{\mathrm{sin}}{}\left({t}\right)\\ {-}{\mathrm{sin}}{}\left({t}\right)& {-}{r}{}{\mathrm{cos}}{}\left({t}\right)\end{array}\right]{,}{-}{{\mathrm{sin}}{}\left({t}\right)}^{{2}}$ (3)
 > $\mathrm{Hessian}\left(r\mathrm{cos}\left(t\right),\left[r,t\right]=\left[1,\frac{\mathrm{\pi }}{3}\right]\right)$
 $\left[\begin{array}{cc}{0}& {-}\frac{\sqrt{{3}}}{{2}}\\ {-}\frac{\sqrt{{3}}}{{2}}& {-}\frac{{1}}{{2}}\end{array}\right]$ (4)

Compatibility

 • The determinant option was introduced in Maple 16.