Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mx = 200;
- vx = 100;
- my = 10;
- vy = 5;
- s = 300;
- k = 100;
- c = 100;
- h = 500;
- x = TruncatedDistribution[{0, [Infinity]},
- NormalDistribution[mx, vx]];
- y = TruncatedDistribution[{0, [Infinity]},
- NormalDistribution[my, vy]];
- 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]*(r + k) + (1 - G[V])*p (s + k),
- V == (1 - F[W])*(p*s - r)}, Assumptions -> {V >= 0, W > 0}];
- func[R_?NumericQ, P_?NumericQ] :=
- FindRoot[eq /. {r -> R, p -> P}, {{V, 1/2}, {W, 1/3}}];
- H[x_?NumericQ] := NIntegrate[(j - h)*f[j], {j, x, [Infinity]}];
- L[P_?NumericQ, x_?NumericQ] :=
- NIntegrate[P*c*g[j], {j, x, [Infinity]}];
- NMaximize[{H[Evaluate[(W /. func[r, p])]] -
- L[p, Evaluate[(V /. func[r, p])]], 0 <= r <= p*s,
- 0 <= p <= 1}, {r, p}, Method -> "NelderMead",
- WorkingPrecision -> 20] // Quiet
- Plot3D[H[F[Evaluate[(W /. func[r, p])]]] -
- L[p, G[Evaluate[(V /. func[r, p])]]], {r, 0, 300}, {p, 0, 1}]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement