Ask Your Question
1

Specifying variables to be included in Hessian calculation

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

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
1

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

tmonteil gravatar image

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

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

Comments

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

Shimi gravatar imageShimi ( 2014-08-13 15:46:25 +0100 )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

Stats

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

Seen: 780 times

Last updated: Aug 11 '14