@Override
    public double logp(double x) {
        if (x <= 0.0) {
            throw new IllegalArgumentException("Invalid x: " + x);
        }

        return (0.5 * nu1 - 1.0) * Math.log(x) - 0.5 * (nu1 + nu2) * Math.log(nu2 + nu1 * x) + fac;
    }
@Test
    public void testLogP() {
        System.out.println("logP");
        FDistribution instance = new FDistribution(10, 20);
        instance.rand();
        assertEquals(-12.74989, instance.logp(0.01), 1E-5);
        assertEquals(-4.196589, instance.logp(0.1), 1E-6);
        assertEquals(-2.121800, instance.logp(0.2), 1E-6);
        assertEquals(-0.374138, instance.logp(0.5), 1E-6);
        assertEquals(-0.3363727, instance.logp(1), 1E-7);
        assertEquals(-11.92045, instance.logp(10), 1E-5);
    }