Ask Your Question
0

Wrong hessian

asked 5 years ago

Cyrille gravatar image

updated 5 years ago

FrédéricC gravatar image

Sorry for the long code but look at the Hessian. It is obviously false since H33=0 not px

%display latex
var('A, x, y, l, alpha, beta, R, p_x, p_y');
U= A*x^(alpha)*y^(beta);
show(LatexExpr("U(x)="+latex(U)))
D = p_x*x + p_y*y;
show(LatexExpr("D="+latex(D)))
L = U-l*(D-R)
show(LatexExpr("L(x,y,l)="+latex(L)))
L_x= L.diff(x) 
show(LatexExpr("L_x(x,y,l)="+latex(L_x)))
L_y= L.diff(y)
show(LatexExpr("L_y(x,y,l)="+latex(L_y)))
L_l= L.diff(l)
show(LatexExpr("L_l(x,y,l)="+latex(L_l)))
z=solve([L_x==0, L_y==0, L_l==0,], x, y, l)
show(z[0])
x1=z[0][0].right()
show(LatexExpr("x^\star(p_x,p_y,R)="+latex(x1)))
y1=z[0][1].right()
show(LatexExpr("y^\star(p_x,p_y,R)="+latex(y1)))
l1=z[0][2].right().canonicalize_radical()
show(LatexExpr("l^\star(p_x,p_y,R)="+latex(l1)))
U1=U.subs(x=x1,y=y1).canonicalize_radical()
show(LatexExpr("U^\star(p_x,p_y,R)="+latex(U1)))
L_xx= L_x.diff(x);
L_xy= L_x.diff(y);
L_xl= L_x.diff(l);
L_yx= L_y.diff(x);
L_yy= L_y.diff(y);
L_yl= L_y.diff(l);
L_lx= L_l.diff(x);
L_ly= L_l.diff(y);
L_ll= L_l.diff(l);
H=matrix([[L_xl,L_xx, L_xy],[L_yl,L_yx, L_ly],[L_xl,L_lx, L_ly]]);
H

Also if I typeset

show(LatexExpr("U^\star(p_x,p_y,R)="+latex(U1)))

I have only the Latex code, which is astonning since SageAMth is capable to print H

Preview: (hide)

Comments

That is indeed astonishing. It would be much more useful if you would paste in the straight output that you get from print H. Please edit your question so that it does show whatever computation you want to do in executable form. I don't think anyone will understand the character string you are currently displaying.

nbruin gravatar imagenbruin ( 5 years ago )

1 Answer

Sort by » oldest newest most voted
1

answered 5 years ago

rburing gravatar image

The matrix you constructed by hand doesn't look like a Hessian to me. Here is the Hessian:

sage: H = L.function(x,y,l).hessian()(x,y,l)
sage: H

(A(α1)αxα2yβAαβxα1yβ1pxAαβxα1yβ1A(β1)βxαyβ2pypxpy0)

Preview: (hide)
link

Comments

Thanks for your answer. Just before reading it I have realized my mistake.

Cyrille gravatar imageCyrille ( 5 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

1 follower

Stats

Asked: 5 years ago

Seen: 775 times

Last updated: Sep 20 '19