8
$\begingroup$

This old answer by @Silvia uses Mesh to find intersections of curves. Unfortunately, it doesn't seem to work in v13.2. For example (based on @JasonB's comment to that answer):

Clear[f, g]
f[x_, y_] := -Cos[y] + 2 y Cos[y^2] Cos[2 x];
g[x_, y_] := -Sin[x] + 2 Sin[y^2] Sin[2 x];

ContourPlot[{f[x, y] == 0, g[x, y] == 0}, {x, -7/2, 4}, {y, -9/5, 21/5},
  MeshFunctions -> {f[#1, #2] - g[#1, #2] &}, Mesh -> {{0}},
  MeshStyle -> Directive[Red, PointSize[Large]]]

enter image description here

There should be red points at the intersections. Any thoughts on how to get this working? What changed?

$\endgroup$
1
  • 1
    $\begingroup$ I also test v11.3 (work),v12.3( not work) , Something must be changed in v12. $\endgroup$
    – cvgmt
    Dec 23, 2022 at 8:40

1 Answer 1

12
$\begingroup$

We can use two MeshFunctions {f[#1, #2] &, f[#1, #2] - g[#1, #2] &}

ContourPlot[{f[x, y] == 0, g[x, y] == 0}, {x, -7/2, 4}, {y, -9/5, 
  21/5}, MeshFunctions -> {f[#1, #2] &, f[#1, #2] - g[#1, #2] &}, 
 Mesh -> {{0}}, MeshStyle -> Directive[Red, PointSize[Large]]]

enter image description here

$\endgroup$
3
  • $\begingroup$ Thanks! I wonder what changed. $\endgroup$
    – Chris K
    Dec 23, 2022 at 3:20
  • $\begingroup$ Even a dummy first function like MeshFunctions -> {0 #1 &, f[#1, #2] - g[#1, #2] &} seems to work. $\endgroup$
    – Chris K
    Dec 23, 2022 at 3:36
  • $\begingroup$ @ChrisK It is also curious to me that {0 &, f[#1, #2] - g[#1, #2] &} also work. $\endgroup$
    – cvgmt
    Dec 23, 2022 at 3:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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