Ask Your Question

Specifying variables to be included in Hessian calculation

asked 2014-08-11 14:58:23 +0200

Shimi gravatar image

I want to calculate the Hessian of a function that has 5 variables and 6 parameters. I do not want the derivatives taken by the parameters.

Is there a way to separately define parameters and variables in sage?

Alternatively, is there a way to make the Hessian function only use some variables for derivation?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-08-11 23:54:20 +0200

tmonteil gravatar image

updated 2014-08-11 23:55:37 +0200

You can try something like this (with x and y as variables and z as parameter):

sage: var('x y z')
(x, y, z)
sage: f(x,y) = x*y*z

sage: f.arguments()
(x, y)
sage: f.variables()
(x, y, z)

sage: f.hessian()
[(x, y) |--> 0 (x, y) |--> z]
[(x, y) |--> z (x, y) |--> 0]
edit flag offensive delete link more


Thank you. That's exactly what I was looking for.

Shimi gravatar imageShimi ( 2014-08-13 15:46:25 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2014-08-11 14:58:23 +0200

Seen: 714 times

Last updated: Aug 11 '14