# How to plot root of the complex equations

I want to plot the roots of the complex equation of a1. I have tried the following code but this is not giving me any result. I need bistable plot. How it is possible.?

del = -1.5;
g0 = 4.8;
del0 = 1.5;
ome = 40;
A1=0;
B1=1;
k1 = 0.1;
kex = 0.1;
kL = (k1+kex)/2-del0*(k1-kex)/(2*ome);
Gma = 0.5;
Solve[{I*del*a1 + I*g0*(1 - del/ome)*A1*Re[b1]*a1 +
I*P0*(1 - del0/(2*ome))/Sqrt[2] +
I*P0*g0*B1*Re[b1]/(Sqrt[2]*ome) -
kL/2*a1 - (k1 - kex)*g0/ome*B1*Re[b1]*a1 ==
0, -I*ome*b1 + I*g0*(1 - del0/ome)*A1*Abs[a1]^2/2 +
I*P0*g0*B1*Re[a1]/(Sqrt[2]*ome) - Gma*b1/2 == 0}, {a1, b1}];
Plot[{Evaluate[Abs[a1]^2 /. %]}, {P0, 0, 3}, Frame -> True,
FrameLabel -> {Style["P0", Bold, 20], Style[" N", Bold, 20]},
FrameTicksStyle -> Directive[FontSize -> 20],
PlotStyle -> {Thickness[0.0005], Thickness[0.011]}]

• What are A1,B1,b What does it mean Re[a1], Re[b1]? Commented Feb 9, 2020 at 12:41
• @OkkesDulgerci oh sorry, A1=0,B1=1; b is b1 and Re[a1] is Real of a1, and Re[b1] is Real of b1. because a1 and b1 are complex.
– vini
Commented Feb 9, 2020 at 12:49

Edit:

ClearAll["Global*"]
A1 = 0;
B1 = 1;
del = -1.5 // Rationalize;
g0 = 4.8 // Rationalize;
del0 = 1.5 // Rationalize;
ome = 40 // Rationalize;
k1 = 0.1 // Rationalize;
kex = 0.1 // Rationalize;
kL = (k1 + kex)/2 - del0*(k1 - kex)/(2*ome);
Gma = 0.5 // Rationalize;

{a1, b1} = {a1, b1} /.
Flatten@Solve[{I*del*a1 + I*g0*(1 - del/ome)*A1*Re[b1]*a1 +
I*P0*(1 - del0/(2*ome))/Sqrt[2] +
I*P0*g0*B1*Re[b1]/(Sqrt[2]*ome) -
kL/2*a1 - (k1 - kex)*g0/ome*B1*Re[b1]*a1 ==
0, -I*ome*b1 + I*g0*(1 - del0/ome)*A1*Abs[a1]^2/2 +
I*P0*g0*B1*Re[a1]/(Sqrt[2]*ome) - Gma*b1/2 == 0}, {a1, b1}]


xVal = Range[0, 3, 0.01];
a1 = a1 /. P0 -> xVal;
pts0 = a1 Conjugate[a1] // Chop;
pts = Transpose[{xVal, pts0}];

ListLinePlot[pts, Frame -> True,
FrameLabel -> {Style["P0", Bold, 20], Style[" N", Bold, 20]},
FrameTicksStyle -> Directive[FontSize -> 20], PlotLegends -> {"a1"}]


    ClearAll["Global*"]
A1 = 0;
B1 = 1;
del = -1.5;
g0 = 4.8;
del0 = 1.5;
ome = 40;
k1 = 0.1;
kex = 0.1;
kL = (k1 + kex)/2 - del0*(k1 - kex)/(2*ome);
Gma = 0.5;
sol = Values@
Flatten@Solve[{I*del*a1 + I*g0*(1 - del/ome)*A1*b1*a1 +
I*P0*(1 - del0/(2*ome))/Sqrt[2] + I*P0*g0*B1*b1/(Sqrt[2]*ome) -
kL/2*a1 - (k1 - kex)*g0/ome*B1*b1*a1 ==
0, -I*ome*b1 + I*g0*(1 - del0/ome)*A1*Abs[a1]^2/2 +
I*P0*g0*B1*a1/(Sqrt[2]*ome) - Gma*b1/2 == 0}, {a1, b1}]


$$\left\{\text{a1}\to -\frac{(3854.71\, -24.092 i) \text{P0}}{1. \text{P0}^2-(8331.6\, -329.861 i)},\text{b1}\to -\frac{8.17708 \text{P0}^2}{1. \text{P0}^2-(8331.6\, -329.861 i)}\right\}$$

    a1 = sol[[1]] /. P0 -> Subdivide[3, 100];
pts0 = a1 Conjugate[a1] // Chop;
pts = Transpose[{Subdivide[3, 100], pts0}];

ListLinePlot[pts, Frame -> True,
FrameLabel -> {Style["P0", Bold, 20], Style[" N", Bold, 20]},
FrameTicksStyle -> Directive[FontSize -> 20], PlotLegends -> {"a1"}]


• I am using mathematica version 9.0 . Why my plot is not coming for the same code?
– vini
Commented Feb 9, 2020 at 14:41
• I am not sure, I using M12. Does it produce any error? Commented Feb 9, 2020 at 15:00
• Values was introduced in v10. Replace it with {a1, b1} /. Commented Feb 9, 2020 at 15:58
• @OkkesDulgerci Have you plotted the (a1 dagger a1) ? beacuse in y-axis it is a1 dagger a1
– vini
Commented Feb 9, 2020 at 17:19
• Let's assume a1=2i+P0 how you wanna plot it? How you define a1*a1? Commented Feb 9, 2020 at 18:43