2

I wish to plot a series of parametric curves for the following function called poly that has five parameters (Γ, κ1, κ2, g1, g2). My parameterization is such that x = g1 and y = g2 while the other three parameters eventually taking on constant values. I first have my equation:

27 (256 g1^6 + (4 g2^2 + (Γ - κ1) (Γ - κ2))^2 (4 g2 + κ1 - κ2) (4 g2 - κ1 + κ2) + 16 g1^4 (48 g2^2 - Γ^2 + 10 Γ κ1 - κ1^2 - 8 (Γ + κ1) κ2 + 8 κ2^2) + 8 g1^2 (96 g2^4 + 4 g2^2 (-10 Γ^2 + Γ κ1 - κ1^2 + 19 Γ κ2 + κ1 κ2 - 10 κ2^2) + (Γ - κ2) (-κ1 + κ2) (Γ^2 - 4 Γ κ1 + κ1^2 + 2 (Γ + κ1) κ2 - 2 κ2^2))) = 0

Which I then call all of the left hand side as poly:

poly = 27 (256 g1^6 + (4 g2^2 + (Γ - κ1) (Γ - κ2))^2 (4 g2 + κ1 - κ2) (4 g2 - κ1 + κ2) + 16 g1^4 (48 g2^2 - Γ^2 + 10 Γ κ1 - κ1^2 - 8 (Γ + κ1) κ2 + 8 κ2^2) + 8 g1^2 (96 g2^4 + 4 g2^2 (-10 Γ^2 + Γ κ1 - κ1^2 + 19 Γ κ2 + κ1 κ2 - 10 κ2^2) + (Γ - κ2) (-κ1 + κ2) (Γ^2 - 4 Γ κ1 + κ1^2 + 2 (Γ + κ1) κ2 - 2 κ2^2)))

Since I need my g2 in terms of g1 for my y-axis, I solve for g2 in terms of all the other parameters (note that g2 is a polynomial of order 6 so I should expect 6 solutions)

{g21p, g21n, g22p, g22n, g23p, g23n} = g2 /. (Solve[poly == 0, g2] /. {Γ -> 1/100, κ1 -> 2.0, κ2 ->3.25});

Where I have named each of the 6 solutions as g21p, g21n, g22p, g22n, g23p, g23n respectively and the parameters Γ, κ1, κ2 all take on 0.01, 2, and 3.25 respectively. I now proceed to produce my parametric plot:

ParametricPlot[{{g1, g21p}, {g1, g21n}, {g1, g22p}, {g1, g22n}, {g1, g23p}, {g1, g23n}}, {g1, 0, 10}, PlotRange -> All, PlotLegends -> "Expressions", PlotPoints -> 100, Exclusions -> None]

And I am returned with: enter image description here

Notice that there's a gap in between the curves. This could be slightly improved by setting WorkingPrecision -> 10 (there is still a tiny gap in between) enter image description here

However, I am returned with a bunch of warnings along the lines of The precision argument function (one of the six g2 solutions) is less than WorkingPrecision (10.) What is going on here and how can I remedy the warnings while fixing the gap?

kowalski
  • 375
  • 1
  • 12
  • One thing that helps is to use exact parameters in for x1 and x2. (It fixes the problem withWorkingPrecision.) Note thatMachinePrecision` is considered "less" than any arbitrary precision setting (see for instance this commnet). – Michael E2 Sep 27 '18 at 20:47
  • The gaps come from not hitting the exact points where the solutions become complex. – Michael E2 Sep 27 '18 at 20:51

1 Answers1

3

Using exact parameters and the correct endpoint

{g21p, g21n, g22p, g22n, g23p, g23n} = 
  g2 /. (Solve[poly == 0, g2] /. {Γ -> 1/100, κ1 -> 2, κ2 -> 325/100});

ParametricPlot[
 {{g1, g21p}, {g1, g21n}, {g1, g22p}, {g1, g22n}, {g1, g23p}, {g1, g23n}}, 
 {g1, 0, (523 Sqrt[523/3])/10800}, 
 PlotRange -> All, PlotLegends -> "Expressions", PlotPoints -> 100, 
 Exclusions -> None, WorkingPrecision -> 16]

Mathematica graphics

Henrik Schumacher
  • 106,770
  • 7
  • 179
  • 309
Michael E2
  • 235,386
  • 17
  • 334
  • 747
  • Thanks! This is very much what I needed. How did you know that the endpoint is at (523 Sqrt[523/3])/10800? That is an oddly specific number of around 0.6. One would think that increasing the range up to a large amount (say {g1, 0, 10}) would include 0.6. How did you figure out the endpoint? – kowalski Sep 27 '18 at 21:50
  • @kowalski Solved for where the expression under the radical was zero. Would've said something but I got interrupted while trying to figure why @halirutan's buttons got disabled by an upgrade to Safari. – Michael E2 Sep 27 '18 at 23:43