1
$\begingroup$

i am wondering if mathematica can automatically assign the value of x in each line in the parametric plot as seen below. This is my script. Is it possible to make this plot in a contour plot? Thank you enter image description here

   q0 = 80;
   Γ = 4/3;
   μ = 1/1000;
   l = μ/2;
   ε0 = 60;
   ψ0 = 1/5;   
   Rinit = 2/1000;
   Finit = 12/10;
   Δinit = 2;
   smax = 1.5 10^-8;

   sM0[s_] := Δ0[s] + q0 Δ0[s]^(2 - Γ)
   h0[s_] := Sqrt[1 - (R[s]* μ)/(l^2 + R[s]^2)]
   M0[s_] := Sqrt[Δ0[s] + q0 Δ0[s]^(2 - Γ)]
   sM0[s_] := Δ0[s] + q0 Δ0[s]^(2 - Γ)

   U0[s_] := (4 π ψ0 (ε0^2 - h0[s]^2 (q0 Δ0[s]^(1 - Γ) + 1)^2))^(1/2)

   G[s_] := M0[s]/Sqrt[U0[s]] 
   sG[s_] := sM0[s]/U0[s]
   γ0[s_] := ε0/((q0 Δ0[s]^(1 - Γ) + 1)*h0[s]); 
   γu0[s_] := Sqrt[γ0[s]^2 - 1];
   γu1[s_] := Δ0[s] Sqrt[γ0[s]^2 - 1];


   Dsonic[s_] := h0[s]^2 (q0 Δ0[s]^(1 - Γ) + 1)^3
   ndΔ0[s_] := (q0 Δ0[s] + Δ0[s]^Γ) 
   dF[s_] := (
    4 π R[s] (l^2 + R[s]^2) (h0[s]^2) (
    sG[s]^2) )/((l^2 + R[s] (R[s] - μ)) (h0[s]^2 - sM0[s])) ndΔ0[s] - 
   4 l^2 R[s]^3  μ + R[s] (-l^4 + R[s]^4) μ F[s]

Numerical differential equation

     Sol = NDSolve[{F'[s] == dF[s], Δ0'[s] == ndΔ0[s], 
     R'[s] == Dsonic[s],  F[0] == Finit, Δ0[0] == Δinit, 
     R[0] == Rinit}, {F, Δ0, R}, {s, 0, smax}, WorkingPrecision -> 32];

      xmin = 0.3;
      xmax = 0.6;
      dx = 0.1;
   

       ParametricPlot[
       Evaluate@Table[{(2 (x - γu0[s]))/γu1[s]*G[s]^2, 
       1 - (2 (x - γu0[s]))/(γu1[s] (R[s]^2 + l^2))*
       G[s]^2 (1 - (2 (x - γu0[s]))/(γu1[s] (R[s]^2 + l^2))*
          G[s]^2)} /. Sol, {x, xmin, xmax, dx}], {s, 0, smax}, 
       AxesLabel -> {"\[CurlyPi]", "z"}, PlotLabel -> "γu", 
       AspectRatio -> Full, PlotRange -> All]
$\endgroup$

1 Answer 1

2
$\begingroup$

With your definition above

xmin = 3/10;
xmax = 6/10;
dx = 1/10;

Plotting,

Show[
 ParametricPlot[Evaluate[
   {(2 (x - γu0[s]))/γu1[s]*G[s]^2,
     1 - (2 (x - γu0[s]))/(γu1[s] (R[s]^2 + l^2))*
       G[s]^2 *
       (1 - (2 (x - γu0[s]))/(γu1[s] (R[s]^2 + l^2))*
          G[s]^2)} /. Sol],
  {s, 0, smax}, {x, xmin, xmax},
  Axes -> False,
  FrameLabel -> (Style[#, 14] & /@ {"ϖ", "z"}),
  PlotLabel -> Style["γu", 14],
  AspectRatio -> Full,
  PlotRange -> All,
  BoundaryStyle -> None,
  PlotLegends -> Placed[
    LineLegend[ColorData[97] /@ Range[(xmax - xmin)/dx + 1],
     Range[xmin, xmax, dx],
     LegendLabel -> Style[HoldForm@x, 14]],
    {0.35, 0.4}]],
 ParametricPlot[Evaluate@
   Table[Tooltip[{(2 (x - γu0[s]))/γu1[s]*G[s]^2,
       1 - (2 (x - γu0[s]))/(γu1[s] (R[s]^2 + l^2))*
         G[s]^2 *
         (1 - (2 (x - γu0[s]))/(γu1[s] (R[s]^2 + l^2))*
            G[s]^2)} /. Sol, x], {x, xmin, xmax, dx}],
  {s, 0, smax}]]

enter image description here

$\endgroup$
2
  • $\begingroup$ Thank you very much for your answer. I am trying to implement this in my original script ,using the same format as your post, and i am getting errors. "" Range does not have the appropriate bounds." Is there something that is specific for this plot only and can not be generalised? Thanks again $\endgroup$
    – Agaph
    May 9, 2023 at 20:59
  • $\begingroup$ I rationalized xmin, xmax, and dx. If you did not, you should change Range[(xmax - xmin)/dx + 1] to Range[Round[(xmax - xmin)/dx] + 1]. If that doesn't fix your problem, you would need to show the actual code that you are using. $\endgroup$
    – Bob Hanlon
    May 9, 2023 at 22:31

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.