Previous Up Next

2.50.3  Hessian matrix : hessian

hessian takes two arguments : an expression F of n real variables and a vector of these variable names.
hessian returns the hessian matrix of F, that is the matrix of the derivatives of order 2.
Example
Find the hessian matrix of F(x,y,z)=2x2yxz3.
Input :

hessian(2*x^2*y-x*z^3 , [x,y,z])

Output :

[[4*y,4*x,-(3*z^2)],[2*2*x,0,0],[-(3*z^2),0,x*3*2*z]]

To have the hessian matrix at the critical points, first input :

solve(derive(2*x^2*y-x*z^3,[x,y,z]),[x,y,z])

Output is the critical points :

[[0,y,0]]

Then, to have the hessian matrix at this points, input :

subst([[4*y,4*x,-(3*z^2)],[2*2*x,0,0], [-(3*z^2),0,6*x*z]],[x,y,z],[0,y,0])

Output :

[[4*y,4*0,-(3*0^2)],[4*0,0,0],[-(3*0^2),0,6*0*0]]

and after simplification :

[[4*y,0,0],[0,0,0],[0,0,0]]

Previous Up Next