Reputation: 733
smys x y A;
L = A*(-2*x -y -3) + 2*x^2 - 2*x*y + 3*y^2;
Lx = diff(L, x);
Ly = diff(L, y);
LA = diff(L, A);
a = solve(Lx, Ly, LA);
a = [a.x, a.y, a.A]
a =
[ -7/6, -2/3, -5/3]
Now this piece looks ok and doing
subs(Lx, {x,y,A}, a)
Gives the expected 0, however, if I were to take the values and manually calculate the Lx/Ly/LA I get anything but 0. Why is it so?
Upvotes: 0
Views: 97
Reputation: 39197
It is correct. If I didn't break the calculations it looks like
Lx = -2*A+4*x-2*y
and thus
Lx = -2*(-5/3)+4*(-7/6)-2*(-2/3) = 10/3 - 14/3 + 4/3 = 0
The same holds for Ly
and LA
.
Upvotes: 1