All problems
Beta Second Moment
Problem
For a Beta(a, b) distribution, E[X^2] = a (a + 1) / ((a + b)(a + b + 1)).
Given a and b, return the second moment.
Hint
Shift the first parameter in both the numerator and the total.
Test cases
case 1
in: [2,2]
expected: 0.3
case 2
in: [1,1]
expected: 0.3333333333333333
case 3
in: [5,2]
expected: 0.5357142857142857
Starter codePython
def beta_second_moment(a, b):
# Your code here
pass3 test cases · run your code against them in the editor