First time here? Check out the FAQ!

Ask Your Question
1

Specifying variables to be included in Hessian calculation

asked 10 years ago

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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 10 years ago

tmonteil gravatar image

updated 10 years ago

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]
Preview: (hide)
link

Comments

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

Shimi gravatar imageShimi ( 10 years ago )

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: 10 years ago

Seen: 890 times

Last updated: Aug 11 '14