Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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}}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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