# Plotting numerical solutions (multi solutions)

I am trying to plot the solutions of this equation.

eq[x_, k_, T_] := -Sin[3*k + x]/Sin[4*k + x] + P +
Cos[k] + T^2 + (A*T^2*Sin[k]^2)/(Sin[4*k + x]^2 +
B*T^2*Sin[k]^2) == 0 /. {A -> 1/2, B -> 0.0001,
P -> -2.38}

sol[T_?NumericQ, k_ /; 0 <= k <= Pi] :=
x /. NSolve[{eq[x, k, T], 0 <= x <= Pi}, x, Reals]

ListLinePlot[Table[sol[T, 0.2], {T, 0.1, 1.2, 0.1}]]


It has three solutions for each T and k, I want to plot for a specific k which I defined in the above case to be $$k=0.2$$ inside sol[T, 0.2]. It gives me a list of multi-solutions for various T values {T, 0.1, 1.2, 0.1}. I want T to be one of the axis of the plot with these three solution curves, but it shows several curves, more than three. Should I use some other type of plot?

ListLinePlot[Transpose@Table[sol[t, 0.2], {t, 0.1, 1.2, 0.1}],
DataRange -> {0, 1.2}, Frame -> True,
FrameLabel -> {t, Subscript[x, i][t, .2]},
PlotLegends -> {Subscript[x, 1][t, .2], Subscript[x, 2][t, .2], Subscript[x, 3][t, .2]}]


• Thanks a lot. This t corresponds to T^2 in the equation then?
– AtoZ
Mar 12, 2019 at 14:59
• Could't we just write 'T' or there was a reason to write 't' instead of 'T'? Thanks
– AtoZ
Mar 12, 2019 at 15:56
• @AtoZ, yes t corresponds to T. You can use T in place of t. I used lower case to avoid possible conflict with a built-in function (e.g. N or C); in this case there is no built-in function T; so it is ok.
– kglr
Mar 12, 2019 at 16:11