0
$\begingroup$

I want to plot the following equation:

\[CapitalDelta] = -2.24;
\[Eta] = 0.05;
x1 = (-2 \[CapitalDelta] Subscript[A, 2] - 2 \[Eta] Subscript[A, 2] - 
   3 
\!\(\*SubsuperscriptBox[\(A\), \(2\), \(2\)]\) - 3 \[Eta]^2 
\!\(\*SubsuperscriptBox[\(A\), \(2\), \(2\)]\) - 
   Sqrt[(2 \[CapitalDelta] Subscript[A, 2] + 
      2 \[Eta] Subscript[A, 2] + 3 
\!\(\*SubsuperscriptBox[\(A\), \(2\), \(2\)]\) + 3 \[Eta]^2 
\!\(\*SubsuperscriptBox[\(A\), \(2\), \(2\)]\))^2 + 
    4 (3 Subscript[A, 2] + 3 \[Eta]^2 Subscript[A, 2]) Subscript[A, 
     in]])/(6 (Subscript[A, 2] + \[Eta]^2 Subscript[A, 2]));
x2 = (-2 \[CapitalDelta] Subscript[A, 2] - 2 \[Eta] Subscript[A, 2] - 
   3 
\!\(\*SubsuperscriptBox[\(A\), \(2\), \(2\)]\) - 3 \[Eta]^2 
\!\(\*SubsuperscriptBox[\(A\), \(2\), \(2\)]\) + 
   Sqrt[(2 \[CapitalDelta] Subscript[A, 2] + 
      2 \[Eta] Subscript[A, 2] + 3 
\!\(\*SubsuperscriptBox[\(A\), \(2\), \(2\)]\) + 3 \[Eta]^2 
\!\(\*SubsuperscriptBox[\(A\), \(2\), \(2\)]\))^2 + 
    4 (3 Subscript[A, 2] + 3 \[Eta]^2 Subscript[A, 2]) Subscript[A, 
     in]])/(6 (Subscript[A, 2] + \[Eta]^2 Subscript[A, 2]));

ContourPlot[{Re[x1], Re[x2]}, {Subscript[A, in], -50, 50}, {Subscript[
  A, 1], -5, 5}]

I need the plot as shown in the literature given below.

But this code does not show any plot. If anyone can resolve this is most welcome.

If this is not possible, then any other method that can be shared would be appreciated.

$\endgroup$
6
  • $\begingroup$ You have not defined D0. What is it? You have the wrong syntax for Solve (as the error it spits out when you evaluate it tells you): it should be Solve[eqn, I2, Reals]. Your choice of PlotRange moves the region away from the region of interest, so just remove it. Fix those things, and it works. However, this doesn't look like a bifurcation plot to me, so I'm not sure exactly what you're trying to do. ParametricPlot here will show the region defined by the solution, but based on your PlotLegends, it appears as if you expect multiple curves. You might need to clarify your issues. $\endgroup$
    – march
    Commented May 24 at 16:51
  • $\begingroup$ @march Thanks for the reply. The value of D0=-2.24. I have applied your suggestion and I have removed the PlotRange also but code is not working. $\endgroup$
    – vijay
    Commented May 24 at 16:58
  • 1
    $\begingroup$ But what do you mean "not working"? The code you have now included shows a plot. You need to give us more details about what you're actually trying to do. I suspect that you're misunderstanding what ParametricPlot does, but without more information, I can't figure out what plotting function you'd actually need to use. In addition, I can't tel what you're plotting against. What variable is on the horizontal axis? $\endgroup$
    – march
    Commented May 24 at 17:14
  • $\begingroup$ Replace sol = Solve[eqn, I2, Reals] by sol = Flatten@Solve[eqn, I2, Reals] to get a region plot, which is what you should get with the code you wrote. If you wish a curve instead of a region, specify I0 and use ContourPlot[Evaluate[eqn /. I0 -> 1], {I1, -5, 5}, {I2, -5, 5}, PlotPoints -> 200]. $\endgroup$
    – bbgodfrey
    Commented May 24 at 19:40
  • $\begingroup$ @march Please now see the edited version. I think this will help you to understand what problem I am facing. $\endgroup$
    – vijay
    Commented May 25 at 15:19

1 Answer 1

1
$\begingroup$

Post code in InputForm so that it is readable.

$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global`*"];

Use indexed variables rather than Subscript. You can display the indexed variables as subscripts using Format.

Format[A[n_]] := Subscript[A, n]

Δ = -2.24 // Rationalize;
η = 0.05 // Rationalize;

x1 = (-2  Δ  A[2] - 2  η  A[2] - 3  A[2]^2 - 
     3  η^2  A[2]^2 - 
        Sqrt[(2  Δ  A[2] + 2  η  A[2] + 3  A[2]^2 + 
          3  η^2  A[2]^2)^2 + 
       4  (3  A[2] + 3  η^2  A[2])  A[in]])/(6  (A[
        2] + η^2  A[2])) //
  Simplify

enter image description here

x2 = (-2  Δ  A[2] - 2  η  A[2] -  3  A[2]^2 - 
    3  η^2  A[2]^2 + 
       Sqrt[(2  Δ  A[2] + 2  η  A[2] + 3  A[2]^2 + 
         3  η^2  A[2]^2)^2 + 
      4  (3  A[2] + 3  η^2  A[2])  A[in]])/(6  (A[2] + η^2  A[2]))

enter image description here

You attempted to plot with A[1]; however, A[1] does not appear in your equations. Assuming that it is A[2]

ContourPlot[{Re[x1], Re[x2]}, 
 {A[in], -50, 50}, {A[2], -5, 5},
 PlotPoints -> 25,
 MaxRecursion -> 4,
 Exclusions -> None,
 WorkingPrecision -> 15]

enter image description here

ContourPlot[{Re[x1], Re[x2]}, 
 {A[in], -50, 50}, {A[2], -5, 5},
 PlotPoints -> 50,
 MaxRecursion -> 5,
 Exclusions -> None,
 FrameLabel -> Automatic,
 PlotLayout -> "Overlaid",
 WorkingPrecision -> 15]

enter image description here

ContourPlot[Re[x1] == Re[x2], 
 {A[in], -50, 50}, {A[2], -5, 5},
 PlotPoints -> 50,
 MaxRecursion -> 5,
 Exclusions -> None,
 FrameLabel -> Automatic,
 PlotLayout -> "Overlaid",
 WorkingPrecision -> 15]

enter image description here

$\endgroup$
6
  • $\begingroup$ I need I1 and I2 in y-axis and I0 in x-axis as I have shown in the question figure. $\endgroup$
    – vijay
    Commented May 24 at 19:57
  • $\begingroup$ Your ParametricPlot indicated that you wanted I1 for the x-axis, and the figure has an undefined symbol on the x-axis. $\endgroup$
    – Bob Hanlon
    Commented May 24 at 20:26
  • $\begingroup$ In x-axis it is I0. $\endgroup$
    – vijay
    Commented May 24 at 20:41
  • $\begingroup$ Please see the edited version. I think this will clear you the question. $\endgroup$
    – vijay
    Commented May 25 at 15:21
  • 2
    $\begingroup$ I have no way of knowing. Those are the plots you get with the (modified) equations that you posted. $\endgroup$
    – Bob Hanlon
    Commented May 25 at 18:42

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