All problems
Cauchy CDF
Problem
Cauchy cumulative distribution function with location x0 and scale gamma:
F(x) = 0.5 + atan((x - x0) / gamma) / pi.
Return 0.0 for gamma <= 0.
Hint
At x = x0 the CDF is one half by symmetry.
Test cases
case 1
in: [0,1,0]
expected: 0.5
case 2
in: [0,1,1]
expected: 0.75
case 3
in: [0,1,-1]
expected: 0.25
case 4
in: [0,0,5]
expected: 0
Starter codePython
import math
def cauchy_cdf(x0, gamma, x):
# Your code here
pass4 test cases · run your code against them in the editor