Skip to content
DeepForgeby svx
All problems
MediumStatisticsst-381

Normal CDF Value

Problem

The normal CDF is Phi((x - mu) / sigma) = 0.5 * (1 + erf((x - mu) / (sigma * sqrt(2)))).

Given x, mu, and sigma > 0, return the probability P(X <= x).

Hint

Center and scale, then use the error function.

Test cases

case 1
in: [0,0,1]
expected: 0.5
case 2
in: [1.96,0,1]
expected: 0.9750021048517796
case 3
in: [10,8,2]
expected: 0.8413447460685429
Starter codePython
def normal_cdf_value(x, mu, sigma):
    # Your code here
    pass

3 test cases · run your code against them in the editor