You have two related problems. The first is that NProbability
finds the probability of a condition being met. However, your condition x - y == 0
is only true when x
and y
are exactly equal, which happens with probability zero.
Fixing the condition to y > x
(and using the default Method
), we get a probability of:
NProbability[
y > x,
{
x \[Distributed] LogNormalDistribution[10, 2],
y \[Distributed] NormalDistribution[5, 2]
},
AccuracyGoal -> 30
]
(* 0. *)
Practically zero, much lower than you expect. I think you have a second problem, which is that LogNormalDistribution
does not do what you expect it to. It is the distribution of Exp[x]
, where x
is normally distributed with the parameters given to LogNormalDistribution
. Therefore in general the mean and standard deviation of the distribution will not be the numbers you put in.
We can use Solve
to find out what the parameters should be:
soln = NSolve[Through[{Mean, StandardDeviation}[LogNormalDistribution[a, b]]] == {10, 2}
&& b > 0, {a, b}, Reals]
(* {{a -> 2.28297, b -> 0.198042}} *)
Now we can use NProbability
again (without any special options):
NProbability[y > x, {
x \[Distributed] LogNormalDistribution[a, b] /. First@soln,
y \[Distributed] NormalDistribution[5, 2]
}]
(* 0.0321748 *)
And this time we get exactly what you expect.
y > x
(or equivalentlyx - y < 0
). That is, the bar will fail when the applied force is greater. Your current statement is that the bar will fail when the applied force is exactly equal to its strength, which for smooth distributions will happen with probability zero. $\endgroup$