Ask Your Question
0

Wrong hessian

asked 2019-09-20 06:52:13 +0100

Cyrille gravatar image

updated 2019-09-20 10:37:39 +0100

FrédéricC gravatar image

Sorry for the long code but look at the Hessian. It is obviously false since $H_{33} = 0$ not $-p_x$

%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

edit retag flag offensive close merge delete

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 ( 2019-09-20 08:19:39 +0100 )edit

1 Answer

Sort by » oldest newest most voted
1

answered 2019-09-20 09:35:00 +0100

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

$$\left(\begin{array}{rrr} A {\left(\alpha - 1\right)} \alpha x^{\alpha - 2} y^{\beta} & A \alpha \beta x^{\alpha - 1} y^{\beta - 1} & -p_{x} \\ A \alpha \beta x^{\alpha - 1} y^{\beta - 1} & A {\left(\beta - 1\right)} \beta x^{\alpha} y^{\beta - 2} & -p_{y} \\ -p_{x} & -p_{y} & 0 \end{array}\right)$$

edit flag offensive delete link more

Comments

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

Cyrille gravatar imageCyrille ( 2019-09-20 11:06:41 +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

1 follower

Stats

Asked: 2019-09-20 06:52:13 +0100

Seen: 617 times

Last updated: Sep 20 '19