# Simultaneous Equations and Optimization

I have the following simultaneous equations.

$$W=G[V](s+80)+(1-G[V])114$$

$$V=(1-F[W])(90-s)$$

where $$F$$ and $$G$$ are cumulative distribution functions of $$x$$ and $$y$$. The variables of $$x$$ and $$y$$ are distributed according to some distribution respectively.

What I want to know is the minimum value of $$1-F[W]$$ when $$s$$ is changed in some range ($$30).

I solved the simultaneous equations with respect to $$W$$ and $$V$$ but was stucked when I try to find a minimum of $$1-F[W]$$. I could plot the graph and I could see where the minimum would be graphically.

How can I use FindMinimum or NMinimize with the solutions of the simultaneous equations? In the code below, NSolve returns a list of rules. I would like to know how I can use this list of rules to derive the minimum of $$1-F[W]$$.

mx = 240
dx = 100
my = 10
dy = 10
x = TruncatedDistribution[{0, ∞}, NormalDistribution[mx, dx]]
y = TruncatedDistribution[{0, ∞}, NormalDistribution[my, dy]]
f[z_] := PDF[x, z]
F[z_] := CDF[x, z]
g[z_] := PDF[y, z]
G[z_] := CDF[y, z]
sol = NSolve[{W == G[V]*(s + 80) + (1 - G[V])*114 &&
V == (1 - F[W])*(90 - s)}, {V, W}]
Plot[1 - F[W] /. sol, {s, 30, 100}]

• Concrete code for the functions would be helpful... May 30, 2019 at 21:29
• Please post something that will parse correctly on copy-paste. And avoid using Symbolize, SubscriptBox and the like. May 31, 2019 at 18:45
• I'm sorry! Corrected the code. May 31, 2019 at 19:01

ClearAll["Global*"]; Remove["Global*"];
mx = 240;
dx = 100;
my = 10;
dy = 10;
a = 100;
b = 1/2;
x = TruncatedDistribution[{0, \[Infinity]},
NormalDistribution[mx, dx]];
y = TruncatedDistribution[{0, \[Infinity]},
NormalDistribution[my, dy]];
f[z_] := PDF[x, z];
F[z_] := CDF[x, z];
g[z_] := PDF[y, z];
G[z_] := CDF[y, z];

eq = Simplify[{W == G[V]*(s + 80) + (1 - G[V])*114,
V == (1 - F[W])*(90 - s)}, Assumptions -> {V > 0, W > 0}];

func[S_?NumericQ] := FindRoot[eq /. s -> S, {{V, 1/2}, {W, 1/3}}]

Plot[1 - F[Evaluate[(W /. func[s])]], {s, 30, 100}] NMinimize[1 - F[Evaluate[(W /. func[s])]], s, Method -> "NelderMead",
WorkingPrecision -> 20] // Quiet

(*{0.84757806941877589235, {s -> 66.588713327134220158}}*)

• Thank you so much for your answer! I learned a lot from your codes. I really appreciate your help. May 31, 2019 at 19:45
• Mariusz, why do you remove the "Global*" you just cleared from? May 31, 2019 at 21:01
• May 31, 2019 at 21:17
• Mariusz, thank you for the links! Those did a bit to clarify the difference between the two, though it still does not ring properly to me--can you help to clarify why you operate with this, I suppose I would call it, workflow? Does it free up the memory, in opposition to ClearAll` merely removing the defined values? Do you use it here to account for any variances in previously defined Global variables, as opposed to creating a local context to avoid this? I should have specified I was hoping for you to clarify in your answer, why you take this unique starting point? Very nice finds & code! May 31, 2019 at 21:30
• @CATrevillian . mathematica.stackexchange.com/questions/37624/… May 31, 2019 at 21:36