Premium problem109. Normal Interval Probability

Easy Locked

For X∼N(μ,σ2)X \sim \mathcal{N}(\mu, \sigma^2), return P(a≤X≤b)P(a \leq X \leq b).

Standardise both ends and difference the CDF, which you can write with the error function:

Φ(z)=12(1+erf ⁣(z2))\Phi(z) = \tfrac{1}{2}\left(1 + \mathrm{erf}\!\left(\tfrac{z}{\sqrt{2}}\right)\right)

Input

mu = 0.0
sigma = 1.0
a = -1.0
b = 1.0

Output

0.6826894921370859

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)