import mpmath


def pdf(x, nu, sigma):
    """
    PDF for the Rice distribution.
    """
    if x <= 0:
        return mpmath.mp.zero
    with mpmath.extradps(5):
        x = mpmath.mpf(x)
        nu = mpmath.mpf(nu)
        sigma = mpmath.mpf(sigma)
        sigma2 = sigma**2
        p = ((x / sigma2) * mpmath.exp(-(x**2 + nu**2)/(2*sigma2)) *
             mpmath.besseli(0, x*nu/sigma2))
    return p