Skip to content
DeepForgeby svx
All problems
HardProbabilitypr-091

Reciprocal Uniform Density

Problem

U is Uniform(0, 1) and Y = 1 / U. Return the probability density of Y at y found by the one-dimensional change of variables formula:

f_Y(y) = 1 / y^2 for y >= 1, else 0.0.

Hint

Invert y = 1/u to get u = 1/y and multiply by |du/dy|.

Test cases

case 1
in: [1]
expected: 1
case 2
in: [2]
expected: 0.25
case 3
in: [0.5]
expected: 0
case 4
in: [10]
expected: 0.01
Starter codePython
def reciprocal_uniform_pdf(y):
    # Your code here
    pass

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