1
$\begingroup$

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]]]

enter image description here

On Mathematica 12.0

The same code produces nothing ! Why??

enter image description here

$\endgroup$
2
  • $\begingroup$ You must change ContourStyle -> None for ContourStyle -> Automatic. $\endgroup$ Mar 17 at 17:41
  • $\begingroup$ Still doesn't give me the same output as the 11.3 version. $\endgroup$ Mar 17 at 17:44
3
$\begingroup$

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]]

enter image description here

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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.