1 | initial version |
This is not a short way but without rhs:
var('x y p_x p_y R λ')
U(x,y)= x*y
L(x,y,λ)= U(x,y)+λ*(R-p_x*x-p_y*y)
sol = solve([L(x,y,λ).diff(x)==0,L(x,y,λ).diff(y)==0,L(x,y,λ).diff(λ)==0],
(x,y,λ),solution_dict=True)[0]
show(x==sol[x])
xs=function('xs')
xs=sol[x]
show(LatexExpr(r'\frac{dx}{dR} = '),xs.diff(R))
2 | No.2 Revision |
This is not a short way but without rhs:
var('x y p_x p_y R λ')
U(x,y)= x*y
L(x,y,λ)= U(x,y)+λ*(R-p_x*x-p_y*y)
sol = solve([L(x,y,λ).diff(x)==0,L(x,y,λ).diff(y)==0,L(x,y,λ).diff(λ)==0],
(x,y,λ),solution_dict=True)[0]
show(x==sol[x])
xs=function('xs')
xs=sol[x]
show(LatexExpr(r'\frac{dx}{dR} = '),xs.diff(R))
'),sol[x].diff(R))