2

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<s<100$).

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]$.

I greatly appreciate your help.

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}]
Tom M.
  • 23
  • 3

1 Answers1

4
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}]

enter image description here

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

(*{0.84757806941877589235, {s -> 66.588713327134220158}}*)
Mariusz Iwaniuk
  • 13,841
  • 1
  • 25
  • 41
  • Thank you so much for your answer! I learned a lot from your codes. I really appreciate your help. – Tom M. May 31 '19 at 19:45
  • Mariusz, why do you remove the "Global`*" you just cleared from? – CA Trevillian May 31 '19 at 21:01
  • 1
    @CATrevillian .See:https://mathematica.stackexchange.com/questions/89846/how-to-clear-everything-in-mathematica/89851#89851 and https://mathematica.stackexchange.com/questions/850/how-do-i-clear-all-user-defined-symbols – Mariusz Iwaniuk May 31 '19 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! – CA Trevillian May 31 '19 at 21:30
  • 1
    @CATrevillian . https://mathematica.stackexchange.com/questions/37624/remove-versus-clearall – Mariusz Iwaniuk May 31 '19 at 21:36
  • Mariusz, hah! Perfect! Thank you! As an aside, I appreciate your conviction & +1 in the provision of links to requests for (very clearly to me now) easily answered requests for clarification/confusion resolution. As well all know, the SE search can be a bit...difficult, so, very truly thank you for these links and helping to clarify what will now be a pivitol part of my workflow! :D – CA Trevillian May 31 '19 at 22:29