2

I want to plot a parametric plot for 2 variables e11 and s11 which depend on 0<=c<=1. Here e11 is a Root object obtained as below:

Xt = 1/(37617.37590264494` - 591.4506750110327` c - 
    50.6866378885597` c^2 + 
    1.` c^3) (-3137.4640264225636` - 
     136154.31329790497` e11 Sqrt[1 + 2 e11] - 
     0.008214030015896925` c^5 e11 Sqrt[1 + 2 e11] + 
     0.000042533535676195276` c^6 e11 Sqrt[1 + 2 e11] + 
     c (2203.389087814458` - 
        3943.7346350900393` e11 Sqrt[1 + 2 e11]) + 
     c^4 (0.057262350184919764` + 
        0.12016460915359387` e11 Sqrt[1 + 2 e11]) + 
     c^3 (-2.9858406572838176` + 
        9.762007101438348` e11 Sqrt[1 + 2 e11]) + 
     c^2 (-29.64035443698749` + 
        51.23107199024322` e11 Sqrt[1 + 2 e11]));

s = Solve[Xt == 0 && 0 <= c <= 1, e11, Reals]

s11 = (71 (1 - c) + 53.5 c) e11;

How can I manipulate e11 so that I can use it in ParametricPlot[{e11, s11}, {c, 0, 1}]?

Any pointers are much appreciated!

Thanks in advance!

RaNa
  • 23
  • 3
  • 1
    You haven't given us the definition of s11; however, try ParametricPlot[Evaluate[{e11 /. s[[1]], s11}], {c, 0, 1}] – Bob Hanlon Jun 12 '23 at 17:07
  • @BobHanlon Thank you for your comment. I have updated s11. I have also tried your suggestion, but it just gives me an empty plot. I am not sure what to make of it. – RaNa Jun 12 '23 at 17:26
  • Adjust Bob's suggestion to apply the solution to both expressions, e11 and s11, since both depend on the solution for e11: ParametricPlot[Evaluate[{e11, s11} /. s[[1]]], {c, 0, 1}] -- maybe add AspectRatio -> 1 to ParametricPlot[]. See the docs for Solve[], the tutorial Manipulating Equations and Inequalities, and https://mathematica.stackexchange.com/questions/18393/what-are-the-most-common-pitfalls-awaiting-new-users/18706#18706 for more about using the solutions produced by Solve[]. – Michael E2 Jun 12 '23 at 18:11

2 Answers2

4
Clear["Global`*"]

Solve is an exact solver, it should generally be given exact numbers (use Rationalize)

Xt = 1/(37617.37590264494` - 591.4506750110327` c - 50.6866378885597` c^2 + 
       1.` c^3) (-3137.4640264225636` - 
      136154.31329790497` e11 Sqrt[1 + 2 e11] - 
      0.008214030015896925` c^5 e11 Sqrt[1 + 2 e11] + 
      0.000042533535676195276` c^6 e11 Sqrt[1 + 2 e11] + 
      c (2203.389087814458` - 3943.7346350900393` e11 Sqrt[1 + 2 e11]) + 
      c^4 (0.057262350184919764` + 0.12016460915359387` e11 Sqrt[1 + 2 e11]) +
       c^3 (-2.9858406572838176` + 9.762007101438348` e11 Sqrt[1 + 2 e11]) + 
      c^2 (-29.64035443698749` + 51.23107199024322` e11 Sqrt[1 + 2 e11])) //
   Rationalize[#, 0] &;

s = Solve[Xt == 0 && 0 <= c <= 1, e11, Reals];

s11 = (71 (1 - c) + 53.5 c) e11;

ParametricPlot[Evaluate[{e11, s11} /. s[[1]]], {c, 0, 1}, AspectRatio -> 1, AxesLabel -> (Style[#, 14] & /@ {"e11", "s11"}), ColorFunction -> Function[{e11, s11, c}, ColorData["Rainbow"][c]], PlotLegends -> Placed[ BarLegend["Rainbow", LegendLabel -> Style[c, 14]], {.8, .6}]]

enter image description here

Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198
0

Although there's an approved answer, I decided to fix two errors in my answer. There are multiple solutions from Solve, and I overlooked the requirement to plot e11 vs s11.

Pick out the first solution and flatten to get rid of nested lists.

s = Flatten[e11 /. First@Solve[Xt == 0 && 0 <= c <= 1, e11, Reals]];
s11 = (71 (1 - c) + 53.5 c) s;

Now the result can be plotted:

ParametricPlot[{s, s11}, {c, 0, 1}, AspectRatio -> 1]

enter image description here