0
$\begingroup$

I'm trying to solve the following problem:

Minimize[{NProbability[(1 - 2 g)*y + g^.5 + s < 
x, {x, y} \[Distributed] UniformDistribution[{{0, 1}, {0, 1}}]], 0 < g < 1 && 0 < s < 1}, {g, s}]

This code gives an error message from NIntegrate (NIntegrate::izero)

Any ideas why the error message? How can I solve the problem? If I run a contour plot of the objective over the constrained area I get something that looks well behaved:

ContourPlot[NProbability[(1 - 2 g)*y + g^.5 + s < x, {x, y} \[Distributed] UniformDistribution[{{0, 1}, {0, 1}}]], {g, 0, 1}, {s, 0, 1}]

enter image description here

$\endgroup$
1
$\begingroup$

Using a transformed distribution solves the error message.

Define:

 Fz = TransformedDistribution[(1 -2g)*y + g^.5 + s - x, {y \[Distributed] UniformDistribution[], x \[Distributed] UniformDistribution[]}]

And use it with the Probability[] command:

Minimize[{Probability[z < 0, z \[Distributed] Fz],0 < g < 1 && 0 < s < 1}, {g, s}]

This yields the following output:

{0., {g -> 0.753979, s -> 0.979782}}
| improve this answer | |
$\endgroup$

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.