I am trying to create a Mathematica script which takes as input a function of two variables, and in turn computes all the necessary steps (finding roots of the first partial derivatives, checking the relevant 2nd order conditions) in a verbose manner (e.g. show all the partial derivatives) to find local extremal points.
Most of this is straightforward, my biggest problem is how to reuse the roots found by Solve[] in successive computations. I started like this:
f[x_,y_] := y^3 -3 x^2 y
dfx[x_,y_]:=D[f[x,y],x]
dfy[x_,y_]:=D[f[x,y],y]
dfxx[x_,y_]:=D[f[x,y],x, x]
dfyy[x_,y_]:=D[f[x,y],y, y]
dfx[x_,y_]:=D[f[x,y],x]
dfxy[x_,y_]:=D[f[x,y],x,y]
dff[x_,y_]:=dfxx[x,y]*dfyy[x,y]-(dfxy[x,y])^2
Solve[{dfx[x,y]==0, dfy[x,y]==0},{x,y}]
Apply[dff, %]
Evaluate[dff[%]]
I am stuck here, any help would be fantastic!
How about this: