SHARE
TWEET

Untitled

a guest Jun 15th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. mx = 200;
  2. vx = 100;
  3. my = 10;
  4. vy = 5;
  5. s = 300;
  6. k = 100;
  7. c = 100;
  8. h = 500;
  9. x = TruncatedDistribution[{0, [Infinity]},
  10.    NormalDistribution[mx, vx]];
  11. y = TruncatedDistribution[{0, [Infinity]},
  12.    NormalDistribution[my, vy]];
  13. f[z_] := PDF[x, z];
  14. F[z_] := CDF[x, z];
  15. g[z_] := PDF[y, z];
  16. G[z_] := CDF[y, z];
  17. eq = Simplify[{W == G[V]*(r + k) + (1 - G[V])*p (s + k),
  18.     V == (1 - F[W])*(p*s - r)}, Assumptions -> {V >= 0, W > 0}];
  19. func[R_?NumericQ, P_?NumericQ] :=
  20.   FindRoot[eq /. {r -> R, p -> P}, {{V, 1/2}, {W, 1/3}}];
  21. H[x_?NumericQ] := NIntegrate[(j - h)*f[j], {j, x, [Infinity]}];
  22. L[P_?NumericQ, x_?NumericQ] :=
  23.   NIntegrate[P*c*g[j], {j, x, [Infinity]}];
  24. NMaximize[{H[Evaluate[(W /. func[r, p])]] -
  25.     L[p, Evaluate[(V /. func[r, p])]], 0 <= r <= p*s,
  26.    0 <= p <= 1}, {r, p}, Method -> "NelderMead",
  27.   WorkingPrecision -> 20] // Quiet
  28. Plot3D[H[F[Evaluate[(W /. func[r, p])]]] -
  29.   L[p, G[Evaluate[(V /. func[r, p])]]], {r, 0, 300}, {p, 0, 1}]
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top