# ContourPlot and MeshFunctions issue between versions 11.3 and 12.0

## On Mathematica 11.3

This code produces the image below (a set of points that I am then using as a pattern for FindRoot):

IIges[x_, y_] := Sin[x]^2 + Sin[y]^2;
xm = 4;

{dx[x_, y_], dy[x_, y_]} = D[IIges[x, y], {{x, y}}];
ContourPlot[dx[x, y] == 0, {x, -xm, xm}, {y, -xm, xm},
ContourStyle -> None, Mesh -> {{0}},
MeshFunctions -> Function[{x, y, z}, dy[x, y]]]

## On Mathematica 12.0

The same code produces nothing ! Why??

• You must change ContourStyle -> None for ContourStyle -> Automatic. – E. Chan-López Mar 17 at 17:41
• Still doesn't give me the same output as the 11.3 version. – SuperCiocia Mar 17 at 17:44

Try this:

IIges[x_, y_] := Sin[x]^2 + Sin[y]^2;
xm = 4; {dx[x_, y_], dy[x_, y_]} = D[IIges[x, y], {{x, y}}];
ContourPlot[{dx[x, y], dy[x, y]} == 0, {x, -xm, xm}, {y, -xm, xm},
ContourStyle -> None, Mesh -> {{0.}}, MeshFunctions -> {dx[#, #] &, dy[#, #]
&}, MeshStyle -> Directive[PointSize[0.009], GrayLevel[0.5]],
LabelStyle -> Directive[Black, Small]]

Another way:

IIges[x_, y_] := Sin[x]^2 + Sin[y]^2;
xm = 4; {dx[x_, y_], dy[x_, y_]} = D[IIges[x, y], {{x, y}}];
ContourPlot[{dx[x, y], dy[x, y]} == 0, {x, -xm, xm}, {y, -xm, xm},
ContourStyle -> None, Mesh -> {{0}}, MeshFunctions -> {#1 &, #2 &, dy[#1, #2] &},
MeshStyle -> Directive[PointSize[0.009], GrayLevel[0.5]],
LabelStyle -> Directive[Black, Small]]

In the next page MeshFunctions. Also try changing MeshFunctions -> {#1 &, #2 &, dy[#1, #2] &} to MeshFunctions -> {x, y, z, dy[x, y]} and see the warning message it sends you.

• This works, thanks. Do you have any idea why the "old" code doesn't return anything in Mathematica 12.0? – SuperCiocia Mar 17 at 20:42
• I have no idea why it doesn't work, but I will check the documentation. Greetings! – E. Chan-López Mar 17 at 21:21
• Documentation: "MeshFunctions in Mathematica 12 must be a pure function or a list of pure functions" – E. Chan-López Mar 17 at 21:40
• Thanks, do you have a link for that? – SuperCiocia Mar 17 at 22:46
• I added the link you requested and an additional comment. Greetings! – E. Chan-López Mar 17 at 23:39