Classify extrema:
ClassifyCriticalPoints[f_,{x_,y_}]:=Module[{X,P,H,g,d,S}, X={x,y};
P=Sort[Solve[Thread[D[f,#] & /@ X==0],X]]; H=Outer[D[f,#1,#2]&,X,X];g=H[[1,1]];d=Det[H];
S[d_,g_]:=If[d<0,"saddle",If[g>0,"minimum","maximum"]];
TableForm[{x,y,d,g,S[d,g],f} /.P,TableHeadings>{None,{x,y,"D","f_xx","Type","f"}}]]
ClassifyCriticalPoints[4 x y  x^3 y  x y^3,{x,y}]
Solve a Lagrange problem with 2 variables
F[x_,y_]:=2x^2+4 x y; G[x_,y_]:=x^2 y;
Solve[{D[F[x,y],x]==L*D[G[x,y],x],D[F[x,y],y]==L*D[G[x,y],y],G[x,y]==1},{x,y,L}]
With 3 variables
F[x_,y_,z_]:=2x^2+4 x y+z; G[x_,y_,z_]:=x^2 y + z; c=1;
Solve[{D[F[x,y,z],x]==L*D[G[x,y,z],x],
D[F[x,y,z],y]==L*D[G[x,y,z],y],
D[F[x,y,z],z]==L*D[G[x,y,z],z],
G[x,y,z]==c},{x,y,z,L}]
With 3 variables and two constraints
F[x_,y_,z_]:=z; G[x_,y_,z_]:=z^2x^2y^2; H[x_,y_,z_]:=4x3y+8z; c=0; d=5;
Solve[{D[F[x,y,z],x]==L*D[G[x,y,z],x] + M D[H[x,y,z],x],
D[F[x,y,z],y]==L*D[G[x,y,z],y] + M D[H[x,y,z],y],
D[F[x,y,z],z]==L*D[G[x,y,z],z] + M D[H[x,y,z],z],
G[x,y,z]==c,
H[x,y,z]==d},
{x,y,z,L,M}]
Check that a function solves a PDE:
f[t_,x_]:=(x/t)*Sqrt[1/t]*Exp[x^2/(4 t)]/(1+ Sqrt[1/t] Exp[x^2/(4 t)]);
D[f[t,x],t]+f[t,x]*D[f[t,x],x]D[f[t,x],{x,2}]
Simplify[%] Chop[%]
Solving a partial differential equation numerically
Please use code from
here.
A partial differential equation (wave equation) with
three variables:
A=Rectangle[{0,0},{1,1}]; Clear[t,x,y];
f[x_,y_]:=Sin[2 Pi x] Abs[Sin[3 Pi y]];
g[x_,y_]:=3 Sin[Pi x] Sin[Pi y];
U=NDSolveValue[{D[u[t,x,y],{t,2}]
Inactive[Laplacian][u[t,x,y],{x,y}]==0,
u[0,x,y] == f[x,y],
Derivative[1,0,0][u][0,x,y]==g[x,y],
DirichletCondition[u[t,x,y] ==0,True]},
u,{t, 0, 2 Pi}, {x,y} \[Element] A];
Plot3D[U[4,x,y],{x,0,1},{y,0,1}]
