2
$\begingroup$

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}]
$\endgroup$
  • 4
    $\begingroup$ Concrete code for the functions would be helpful... $\endgroup$ – Henrik Schumacher May 30 '19 at 21:29
  • $\begingroup$ Thank you for your comments. I added my codes. $\endgroup$ – Tom M. May 31 '19 at 18:17
  • 1
    $\begingroup$ Please post something that will parse correctly on copy-paste. And avoid using Symbolize, SubscriptBox and the like. $\endgroup$ – Daniel Lichtblau May 31 '19 at 18:45
  • $\begingroup$ I'm sorry! Corrected the code. $\endgroup$ – Tom M. May 31 '19 at 19:01
4
$\begingroup$
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}}*)
$\endgroup$
  • $\begingroup$ Thank you so much for your answer! I learned a lot from your codes. I really appreciate your help. $\endgroup$ – Tom M. May 31 '19 at 19:45
  • $\begingroup$ Mariusz, why do you remove the "Global`*" you just cleared from? $\endgroup$ – CA Trevillian May 31 '19 at 21:01
  • 1
    $\begingroup$ @CATrevillian .See:mathematica.stackexchange.com/questions/89846/… and mathematica.stackexchange.com/questions/850/… $\endgroup$ – Mariusz Iwaniuk May 31 '19 at 21:17
  • $\begingroup$ 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! $\endgroup$ – CA Trevillian May 31 '19 at 21:30
  • 1
    $\begingroup$ @CATrevillian . mathematica.stackexchange.com/questions/37624/… $\endgroup$ – Mariusz Iwaniuk May 31 '19 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.