(1)
One way to get a list of { {x,y}, ... } values suitable for ListPlot
is to Splice the list produced by ReplaceAll
into the surrounding list, thereby avoiding the problem of the extra set of braces in the first place:
etwo= Table[{b, Splice[λ /.
NSolve[{(c λ)/(c λ - 1) - k/c (c λ)^2 +
c^2 (μ (b - Bs)) == 0, λ >= 0},
Reals]]}, {b, 101, Bs, 0.2}]
Short[etwo]
(* {{101., 0.26994}, {101.2, 0.268292}, <<93>>, {120., 0.}} *)
(2)
ListPlot[etwo, Frame -> True, Joined -> True, GridLines -> Automatic, PlotRange -> All]
(3)
Short[energy]
{{101., {0.26994}}, {101.2, {0.268292}}, <<93>>, {120., {0.}}}
There are many ways to convert the list energy
into a list of { {x,y}, ...} values (ie convert energy
to etwo
), including:
Flatten/@energy==etwo
Delete[#,{2,0}]&/@energy==etwo (* delete the Head *)
Replace[energy, {x_,{y_}}-> {x,y},{1}] ==etwo
( * True
True
True *)
ReplaceAll may also be used, but is risky with pattern matching and IMO is best avoided.
(4) Delete vs Flatten
Compare:
expt={{a1, {b1},{c1}},{a2,{b2},{c2}}}
Flatten/@expt
Delete[#,{2,0}]&/@expt
{{a1, {b1}, {c1}}, {a2, {b2}, {c2}}}
{{a1, b1, c1}, {a2, b2, c2}}
{{a1, b1, {c1}}, {a2, b2, {c2}}}
Part
,First
. $\endgroup$