All problems
Standard Normal Quantile by Bisection
Problem
Invert the standard normal CDF by bisection on [-10, 10]: repeatedly halve the interval according to whether Phi(mid) is below or above p.
Given p in (0, 1), use 200 bisection iterations and return the resulting z.
Hint
Bisection converges to machine precision in far fewer than 200 steps.
Test cases
case 1
in: [0.5]
expected: -6.95729106167942e-17
case 2
in: [0.975]
expected: 1.9599639845400532
case 3
in: [0.1]
expected: -1.2815515655446004
Starter codePython
def standard_normal_quantile_by_bisection(p):
# Your code here
pass3 test cases · run your code against them in the editor