Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

how to properly substitute in a matrix?

Let's consider a modified example from Sage reference manual

f(x,y)=x^2*y+y^2+y

solutions=solve(list(f.diff()),[x,y])

the_solution=solutions[2]

H=f.diff(2); # Hessian matrix

How can i properly substitute the_solution into H?

I have tried:

H(x,y).subs(the_solution) - does not work.

This will work for H(x,y).subs(x==0)

H(x,y).subs_expr(*the_solution) - does not work.

This will work for f(x,y).subs_expr(*the_solution)

click to hide/show revision 2
No.2 Revision

updated 2011-06-23 06:15:25 -0600

kcrisman gravatar image

how to properly substitute in a matrix?

Let's consider a modified example from Sage reference manual

f(x,y)=x^2*y+y^2+y

solutions=solve(list(f.diff()),[x,y])

the_solution=solutions[2]

f(x,y)=x^2*y+y^2+y
solutions=solve(list(f.diff()),[x,y])
the_solution=solutions[2]
H=f.diff(2);  # Hessian matrix

matrix

How can i properly substitute the_solution into H?

I have tried:

H(x,y).subs(the_solution) - does not work.

This will work for H(x,y).subs(x==0)

H(x,y).subs_expr(*the_solution) - does not work.

This will work for f(x,y).subs_expr(*the_solution)