Plot with implicit function

This question is a follow-up from this post. Consider a function $$e=f(w,a;i,\lambda)$$ where $$w$$ is implicitly defined as $$w=g(a;i,\lambda)$$ such that $$w\geq 0$$. Hence $$e$$ is eventually a function of $$a$$, i.e. $$e=f(a;i,\lambda)$$.

The code for $$e$$ is

e == (w + a (-1 - a w + w^2) - \[Sqrt](a (a - (-1 + a^2) (i + lambda) w + a (i + lambda) w^2)))/(w + a w (-a + w))


And the code for the implicit function for $$w$$ is

-((a (-1 + a^2 - 2 a w) ((i + lambda) w - a^2 (i + lambda) w + a (2 + (i + lambda) w^2) + 2 \[Sqrt](a (a - (-1 + a^2) (i + lambda) w + a (i + lambda) w^2))))/(2 \[Sqrt](a (a - (-1 + a^2) (i + lambda) w + a (i + lambda) w^2)) (w + a w (-a + w))^2)) == 1/w ((w + a (-1 - a w + w^2) - \[Sqrt](a (a - (-1 + a^2) (i + lambda) w + a (i + lambda) w^2)))/(w + a w (-a + w)))


In the above link, I wanted to plot $$e$$ against $$a$$ with varying parameter values of $$i \in [0,1]$$ and $$\lambda \in [0,1]$$. This time, I would like to plot $$\frac{e}{w}$$ against $$a$$.

Applying the code from the answer (by Bob Hanlon) of the above link, my code for this question is:

eqns2 = {L == 1/w (w + a (-1 - a w + w^2) - \[Sqrt](a (a - (-1 + a^2) (i + lambda) w + a (i + lambda) w^2)))/(w + a w (-a + w)), -((a (-1 + a^2 - 2 a w) ((i + lambda) w - a^2 (i + lambda) w + a (2 + (i + lambda) w^2) + 2 \[Sqrt](a (a - (-1 + a^2) (i + lambda) w + a (i + lambda) w^2))))/(2 \[Sqrt](a (a - (-1 + a^2) (i + lambda) w + a (i + lambda) w^2)) (w + a w (-a + w))^2)) == 1/w ((w + a (-1 - a w + w^2) - \[Sqrt](a (a - (-1 + a^2) (i + lambda) w + a (i + lambda) w^2)))/(w + a w (-a + w))), 0 <= i <= 1, 0 <= lambda <= 1, 0 <= a <= 1, L >= 0, w >= 0};

sol2[i_, lambda_, a_] = SolveValues[eqns2, L, {w}, Reals] // Normal

Manipulate[Plot[Evaluate@sol2[i, lambda, a], {a, 0, 1}, Frame -> True, PlotRange -> {0, 1}, FrameLabel -> (Style[#, 14] & /@ {"a", "e/w"})], {{i, 0.1}, 0, 1, 0.01, Appearance -> "Labeled"}, {{lambda, 0.1}, 0, 1, 0.01, Appearance -> "Labeled"}]


It runs forever... I don't know why because the structure is exactly the same as in the above link.

To plot e/w versus a

Clear["Global*"]

eqns[i_, lambda_] = {e == (w +
a (-1 - a w +
w^2) - √(a (a - (-1 + a^2) (i + lambda) w +
a (i + lambda) w^2)))/(w +
a w (-a +
w)), -((a (-1 + a^2 - 2 a w) ((i + lambda) w - a^2 (i + lambda) w +
a (2 + (i + lambda) w^2) +
2 √(a (a - (-1 + a^2) (i + lambda) w +
a (i + lambda) w^2))))/(2 √(a (a - (-1 + a^2) (i +
lambda) w + a (i + lambda) w^2)) (w + a w (-a + w))^2)) ==
1/w ((w +
a (-1 - a w +
w^2) - √(a (a - (-1 + a^2) (i + lambda) w +
a (i + lambda) w^2)))/(w + a w (-a + w))), r == e/w,
0 <= i <= 1, 0 <= lambda <= 1, 0 <= a <= 1, 0 <= e <= 1, w >= 0};


Plotting,

Manipulate[
Module[{i = Rationalize[iv], lambda = Rationalize[lambdav]},
sol = SolveValues[eqns[i, lambda], r, {e, w}, Reals];
Plot[Evaluate@sol, {a, 0, 1},
PlotRange -> {0, 1},
Frame -> True,
FrameLabel -> (Style[#, 14] & /@ {"a", "e/w"})]] // Quiet,
{{iv, 0.1, "i"}, 0, 1, 0.01, Appearance -> "Labeled"},
{{lambdav, 0.1, "lambda"}, 0, 1, 0.01, Appearance -> "Labeled"},
SynchronousUpdating -> False,
TrackedSymbols :> All]


• Bob, thanks so much, it worked!
– ppp
Commented Jan 12, 2023 at 4:14
• To plot w/(a*e), in eqns, change r == e/w to r == w/(a*e); change plot range to PlotRange -> {0, 23}, and change second frame label to HoldForm[w/(a e)]` Commented Jan 12, 2023 at 4:14
• Thanks, Bob! It works great!
– ppp
Commented Jan 12, 2023 at 4:17