6
$\begingroup$

I just updated my Mathematica for Windows to 13.3 and when I tried to use the "Graphics MeshFindIntersections" command it doesn't seem to work. Have they replaced it with some other command or is it a bug in the new update?

Code used

T[rh_, Q_, P_] := 1/(4 \[Pi] rh) (1 + 8 \[Pi] P rh^2 - Q^2/rh^2)
M[rh_, Q_, P_] := rh/2 + (4 \[Pi] P rh^3)/3 + Q^2/(2 rh)
V[rh_] := 4/3 \[Pi] rh^3
S[rh_] := \[Pi] rh^2
G[rh_, Q_, P_] = Simplify[M[rh, Q, P] - (T[rh, Q, P] S[rh])];
{rc, Pc} = 
  SolveValues[{D[T[rh, Q, P], {rh, 2}] == 0, 
     D[T[rh, Q, P], rh] == 0}, {rh, P}][[2]];
Vc = V[rc]; Tc = T[rc, Q, Pc]; Gc = G[rc, Q, Pc];
T = t Tc; P = p Pc; rh = z rc; G = g Gc;
t[z_, p_] = 
  SolveValues[{T == 1/(4 \[Pi] rh) (1 + 8 \[Pi] P rh^2 - Q^2/rh^2)}, 
    t][[1]];
g[z_, p_] = 
  SolveValues[{G == (3 Q^2)/(4 rh) + rh/4 - 2/3 P \[Pi] rh^3}, g][[1]];
pplt = ParametricPlot[Evaluate@{t[z, 0.5], g[z, 0.5]}, {z, 0, 10}, 
  PlotRange -> {{0.6, 1.3}, {0.8, 1.3}}, AspectRatio -> 1]
ip = Graphics`Mesh`FindIntersections@pplt
$\endgroup$
9
  • $\begingroup$ Can you please load the code that failed? $\endgroup$
    – Syed
    Aug 23, 2023 at 13:21
  • $\begingroup$ Sure. One minute, let me edit it! $\endgroup$
    – codebpr
    Aug 23, 2023 at 13:22
  • $\begingroup$ T is a function name and a parameter name! $\endgroup$ Aug 23, 2023 at 13:36
  • $\begingroup$ Ah my mistake! Even if I change the name, the problem still exists. $\endgroup$
    – codebpr
    Aug 23, 2023 at 13:38
  • $\begingroup$ t and g diverge at zero. Therefore, you can not plot from zero. You may plot z e.g.:{z, 0.1, 10} $\endgroup$ Aug 23, 2023 at 13:40

2 Answers 2

11
$\begingroup$
$Version

"13.3.1 for Microsoft Windows (64-bit) (July 24, 2023)"

pt = Graphics`Mesh`FindIntersections[pplt // DiscretizeGraphics, 
  Graphics`Mesh`AllPoints -> False]
Show[pplt, Graphics[{Red, AbsolutePointSize[10], Point@pt}]]

{{0.757021, 1.07072}}

enter image description here

  • It must be a bug. Here we test another example.
Clear["Global`*"];
pp = ParametricPlot[{Sin[10 t], Sin[9 t]}, {t, 0, 2 π}];
intersections1 = Graphics`Mesh`FindIntersections[pp];
intersections2 = 
  Graphics`Mesh`FindIntersections[pp // DiscretizeGraphics, 
   Graphics`Mesh`AllPoints -> False];
{Show[pp, Epilog -> {Red, PointSize[Large], Point@intersections1}], 
 Show[pp, Epilog -> {Red, PointSize[Large], Point@intersections2}]}

enter image description here

$\endgroup$
5
  • $\begingroup$ Are the new constraints required for the new 13.3 version of Mathematica or are they just for this particular problem? $\endgroup$
    – codebpr
    Aug 23, 2023 at 14:01
  • 1
    $\begingroup$ @codebpr Seems be a bug. Here just a working around. $\endgroup$
    – cvgmt
    Aug 23, 2023 at 14:05
  • $\begingroup$ @cvgmt And the code really runs on v13.3 without recursion error due to naming errors (function T[...]and parameter T) and others?? I tried v12.2 and got several errors. $\endgroup$ Aug 23, 2023 at 14:39
  • $\begingroup$ @UlrichNeumann Without any errors message in 13.3.1 $\endgroup$
    – cvgmt
    Aug 23, 2023 at 14:42
  • $\begingroup$ @cvgmt Astonishing, thanks. $\endgroup$ Aug 23, 2023 at 14:46
2
$\begingroup$

Same problem with Annotation is in Finding intersection of two curves using mesh functions:

Block[{Annotation = # &}, ip = Graphics`Mesh`FindIntersections@pplt]

(* {{0.757021, 1.07072}} *)
$\endgroup$

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.