It appears that the solution of x -> 2.94159
that you mention in a comment in @Hugh 's answer is incorrect (or maybe better said as "inappropriate"). (@Hugh 's answer essentially says it all.)
That particular solution is really at a discontinuity. If you plug in $\pi-2/10$ for $x$ (i.e., essentially what x -> 2.94159
means), you'll get
Consider a slight change in your equation (rationalizing the constants and removing the ==0
):
eq[x_, k_, T_] := -Sin[3*k + x]/Sin[2*k + x] + z + 2*Cos[k] +
T^2 + (A*T^2*Sin[k]^2)/(Sin[2*k + x]^2 + B*T^4*Sin[k]^2) /.
{A -> 1/2, B -> 10^-5, z -> -237/100}
Then we have
eq[x, 1/10, 1]
If $\pi-2/10$ is substituted for $x$, then $\csc \left(x+\frac{1}{5}\right)$ results in ComplexInfinity
:
Csc[1/5 + x] /. x -> π - 2/10
So, in short, there are only two contour lines of zero, not three, when $T=0.1$.
Oooops! I guess there are more than two contours. See @MichaelE2 's answer.
Addition
In general we have for eq[x,k,T]
The discontinuity occurs when Csc[2 k + x]
is ComplexInfinity
or whenever $2k+x=\pi$ or $2k+x=2\pi$ no matter what the value of $T$ happens to be for the ranges of interest of $x$ and $k$. So you could always include those (dotted) lines of discontinuity to your contour plots:
Here is the code to produce the animated contour plot:
t = {"0.025", "0.050", "0.075", "0.100", "0.125", "0.150", "0.175", "0.200", "0.225",
"0.250", "0.275", "0.300", "0.325", "0.350", "0.375", "0.400", "0.425", "0.450",
"0.475", "0.500", "0.525", "0.550", "0.575", "0.600", "0.625", "0.650", "0.675",
"0.700", "0.725", "0.750", "0.775", "0.800", "0.825", "0.850", "0.875", "0.900",
"0.925", "0.950", "0.975", "1.000"};
eq[x_, k_, T_] := -Sin[3*k + x]/Sin[2*k + x] + z + 2*Cos[k] +
T^2 + (A*T^2*Sin[k]^2)/(Sin[2*k + x]^2 + B*T^4*Sin[k]^2) /. {A -> 1/2, B -> 10^-5, z -> -237/100}
g = Table[Show[ContourPlot[Evaluate[eq[x, k, T/40] == 0], {x, 0, π}, {k, 0, π},
PlotPoints -> 100, AspectRatio -> 1,
FrameLabel -> (Style[#, Bold, 18] &) /@ {"x", "k"},
PlotLabel -> Style["T = " <> t[[T]], Bold, 24]],
Plot[{π/2 - x/2, π - x/2}, {x, 0, π},
PlotRange -> {{0, π}, {0, π}}, AspectRatio -> 1,
PlotStyle -> {{Gray, Dotted}}]], {T, 40}];
Export["contours.gif", Flatten[{g, Table[g[[i]], {i, Length[g], 2, -1}]}],
"DisplayDurations" -> 0.25, AnimationRepetitions -> Infinity]
NSolve[{eq[x, k, 1/10] /. x -> 1.5, 0 < k < Pi}, k, WorkingPrecision -> 16]
$\endgroup$wp = 100; k0 = k /. NSolve[{eq[x, k, 1/10] == 0 /. x -> x0, 0 < k < Pi}, k, WorkingPrecision -> wp]; ListLinePlot[ Table[ eq[1, k, 1/10], {k, k0[[2]] - 1*^-7, k0[[2]] + 1*^-7, 1*^-9}], GridLines -> {k0, None}, DataRange -> {k0[[2]] - 1*^-7, k0[[2]] + 1*^-7}]
---ListLinePlot[ Table[ eq[1, k, 1/10], {k, k0[[3]] - 1*^-7, k0[[3]] + 1*^-7, 1*^-9}], GridLines -> {k0, None}, DataRange -> {k0[[3]] - 1*^-7, k0[[3]] + 1*^-7}]
$\endgroup$x
are the sought solutions (a phase to be found between $0\leq x\leq \pi$). You fixed it tox=1.5
, When I replacex
withk
I get the three solutions for each fixedk
: cf.NSolve[{eq[x, k, 1/10] /. k -> 1.5, 0 < x < Pi}, x, WorkingPrecision -> 16]
$\endgroup$ContourPlot
, and thinking you were solving fork
as a function ofx
(and I was getting six lines), than to what you wrote. I get only three roots $x$ for $k(x) = k_0$, as well. The problem withContourPlot
is that two of solutions are too close to be resolved by the typical sampling density ofContourPlot
, which finds curves by sign changes. The plot should still look like the plot in my answer, but, as you can see, two solutions overlap each other at normal image resolution. $\endgroup$ContourPlot
failed. Theoretically,ContourPlot
should start to resolve the roots withPlotPoints -> 3000
($\Delta x \approx 0.0005-0.005$, interval length $\pi \approx 3$), maybe considerably less, but that's a prohibitive computation for my laptop. And you would need to make the image roughly 3000 pixels wide, or zoom in. Please look at my answer, and if there's something you'd like me to show you, I'll try. $\endgroup$