Ask Your Question

Specifying variables to be included in Hessian calculation

asked 2014-08-11 07:58:23 -0500

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 16:54:20 -0500

tmonteil gravatar image

updated 2014-08-11 16:55:37 -0500

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 08:46:25 -0500 )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 07:58:23 -0500

Seen: 368 times

Last updated: Aug 11 '14