All problems
Student t PDF Value
Problem
Student t probability density with nu degrees of freedom at x:
f(x) = Gamma((nu + 1) / 2) / (sqrt(nu * pi) * Gamma(nu / 2)) * (1 + x^2 / nu)^(-(nu + 1) / 2).
Return 0.0 for nu <= 0.
Hint
Use lgamma for the ratio of Gamma functions.
Test cases
case 1
in: [1,0]
expected: 0.3183098861837906
case 2
in: [1,1]
expected: 0.1591549430918953
case 3
in: [2,0]
expected: 0.35355339059327373
case 4
in: [0,0]
expected: 0
Starter codePython
import math
def t_pdf_value(nu, x):
# Your code here
pass4 test cases · run your code against them in the editor