Ask Your Question

# Wrong hessian 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)
x1=z.right()
show(LatexExpr("x^\star(p_x,p_y,R)="+latex(x1)))
y1=z.right()
show(LatexExpr("y^\star(p_x,p_y,R)="+latex(y1)))
l1=z.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 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.

## 1 Answer

Sort by » oldest newest most voted 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)$$

more

## Comments

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

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

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

Seen: 82 times

Last updated: Sep 20 '19