Solve implicit equations and plot solutions as parameter changes

I have the following two implicit equations that are functions of a parameter $$f \in (.5,1]$$. I would like to solve these two equations (i.e get $$\sigma_D$$ and $$\sigma_M$$) for different $$f$$ values and then plot the resulting solutions in $$\sigma_D-\sigma_M$$ space where $$\sigma_D, \sigma_M \in [0,1]$$

$$\sigma_D = \frac{.5}{2.1}((\frac{\sigma_D^2 + (1-\sigma_D)(2-\sigma_D)f^2 }{\sigma_D^2 + (2-\sigma_D)^2 f^2} - \frac{1-\sigma_D}{2-\sigma_D})(\sigma_D - (2-\sigma_D)f^2)+1) + \frac{.1}{2.1}$$ $$\sigma_M = \frac{(1-f)}{2.1} (\frac{\sigma_M + (1-\sigma_M)f }{\sigma_M + (1-\sigma_M) f + f} - \frac{1-\sigma_M}{2-\sigma_M}) + \frac{.1}{2.1}$$

Doing some algebra, it is obvious that both $$\sigma$$'s are decreasing in $$f$$ and that they have max and min values $$<1$$ and $$>0$$ respectively.

What I have written down are all the equations but I don't know how to go about it:

e = .1
c = 2
gr = (sm + (1 - sm) f)/(sm + (1 - sm) f + f)
xm = (1 - sm)/(2 - sm)
cm = (1 - f) (gr - xm)
h1 = sm - (cm + e)/(c + e)

grr = (sd^2 + (1 - sd) (2 - sd) f^2)/(sd^2 + (2 - sd)^2 f^2)
xd = (1 - sd)/(2 - sd)
cd = .5 ((grr - xd) (sd - (2 - sd) f^2) + 1)
h2 = sd - (cd + e)/(c + e)

ContourPlot3D[{h1 == 0, h2 == 0}, {sm, 0, .3},  {f, .5, 1}, {sd,
0, .3}, AxesLabel -> Automatic, PlotLegends -> "Expressions"]
Clear[e, c, gr, xd, xm, cm, sd, sm, h1, h2, grr, cd]

I'm struggling with how to go about it. My best guess was Contour Plotting but that wasn't too useful as I need the solutions of the two equations plotted in $$\sigma_D-\sigma_M$$ space for different $$f$$ values.

However, contour plotting does show precisely what I want. The intersection of the blue and the orange plane shows a positive relation between $$\sigma_D$$ and $$\sigma_M$$ as $$f$$ decreases from $$1$$ to $$.5$$. Any help will be appreciated. Thanks a ton.

• Try ContourPlot for every equation H1 and h2 Jul 9 '19 at 20:32
• Can get equations relating sm respectively sd and f via In:= GroebnerBasis[Numerator[Together[{h1, h2}]], {sm, sd}, CoefficientDomain -> RationalFunctions] Out= {48. f^2 - 240. f^2 sd + (12. + 278. f^2) sd^2 + (-43. - 127. f^2) sd^3 + (21. + 21. f^2) sd^4, -4. f + (-12. + 98. f) sm + (43. - 85. f) sm^2 + (-21. + 21. f) sm^3} Jul 9 '19 at 21:15

Format[sd] := Subscript[σ, D];
Format[sm] := Subscript[σ, M];

e = 1/10;
c = 2;
gr = (sm + (1 - sm) f)/(sm + (1 - sm) f + f);
xm = (1 - sm)/(2 - sm);
cm = (1 - f) (gr - xm);
h1 = sm - (cm + e)/(c + e);

grr = (sd^2 + (1 - sd) (2 - sd) f^2)/(sd^2 + (2 - sd)^2 f^2);
xd = (1 - sd)/(2 - sd);
cd = 1/2 ((grr - xd) (sd - (2 - sd) f^2) + 1);
h2 = sd - (cd + e)/(c + e);

eqns = h1 == 0 && h2 == 0 // Simplify;

sol = Solve[eqns && 0 <= sd <= 1 && 0 <= sm <= 1,
{sd, sm}, Reals] ParametricPlot[
Evaluate[{sd, sm} /. sol], {f, -3, 3},
PlotRange -> {{0, 1}, {0, 1}},
AspectRatio -> 1,
PlotLegends ->
Placed[{"sol[]", "sol[]"}, {0.5, 0.1}],
PlotPoints -> {25, 100},
MaxRecursion -> 15,
Frame -> True,
FrameLabel -> (Style[#, 16, Bold] & /@ {sd, sm})] EDIT: If f is restricted to the interval (1/2, 1) there is a single solution in a highly restricted range of {sd, sm}

sol2 = Solve[eqns && 0 <= sd <= 1 && 0 <= sm <= 1 && 1/2 < f < 1,
{sd, sm}, Reals] ParametricPlot[Evaluate[{sd, sm} /. sol2], {f, 1/2, 1},
AspectRatio -> 1,
Frame -> True,
FrameLabel -> (Style[#, 16, Bold] & /@ {sd, sm})] • Okay this works perfectly. Thank you so much. I simply tweaked the range of possible $f$ to (.5,1). However, I still have a couple of clarification questions: 1) Why are there two solutions? Is it because your range of $f$ is bigger and there could be different solutions in different ranges? 2) Does it matter how much initial sample size is (through the choice of plotpoints)? In particular, what's the benefit of choosing {25,100} vs. {100,100}? Thanks again, this was immensely helpful. Jul 10 '19 at 8:53
• @A.Pant - The initial sampling is not critical. The defaults work fine. I had changed the PlotPoints and MaxRecursion from the defaults trying to close a small gap between the two solutions. Turned out that extending the range of f was needed to close the gap. I just never bothered to reset the options. Jul 10 '19 at 12:38

First, I think there is a subscript missing in the denominator of your second typeset equation. That is the only sigma without a subscript and I guessed you meant sigma subscript M. If my guess is incorrect then please explain my error and I will fix that.

Next you say you want to solve for sigma subscript D and sigma subscript M in terms of f. You have denominators and decimal approximations and it appears that your denominators are never zero so I rewrite your two typeset equations as

e1=Together[5/21((sd^2+(1-sd)(2-sd)f^2/(sd^2+(2-sd)^2f^2)-(1-sd)/(2-sd))*(sd-(2-
sd)f^2)+1)+1/21];
e2=Together[(1-f)/(21/10)((sm+(1-sm)f)/(sm+(1-sm)f+f)-(1-sm)/(2-sm))+1/21];
Reduce[{sd*Denominator[e1]==Numerator[e1],sm*Denominator[e2]==Numerator[e2]},{sd,sm}]

That quickly gives you an assortment of values for sigma subscript D and sigma subscript M in terms of f. That result is complicated, but if you look carefully at it then you might notice that six of those Root are all of exactly the same polynomial. With a little thought you might be able to discard some of those solutions, for example you might be thinking that f is Real. If you can provide any additional constraints to Reduce then you might get a substantially simpler solution that may help you find what you want.

If you can get useful information from that result and use that to clarify what you are really looking to get then perhaps I can modify this to be even more helpful.

• Wow! That's quite a smart solution. Yes, $f \in (.5,1]$ and both $\sigma_D$ and $\sigma_M$ are between 0 and 1. So I'm not looking for imaginary solution. I've also edited my original question with the correction you pointed out, and shown exactly what I want using the contour plot. Jul 9 '19 at 18:46
• Ah, Reduce[{sd*Denominator[e1]==Numerator[e1],sm*Denominator[e2]==Numerator[e2], 1/2<f<=1,0<sm<1,0<sd<1},{sd,sm}] is dramatically simpler
– Bill
Jul 9 '19 at 19:53