//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void test()
        public virtual void test()
        {
            ProbabilityDistribution <double> dist = new StudentTDistribution(1, ENGINE);

            assertCDFWithNull(dist);
            assertPDFWithNull(dist);
            assertInverseCDF(X, dist);
            for (int i = 0; i < 10; i++)
            {
                dist = new StudentTDistribution(DOF[i], ENGINE);
                assertEquals(P[i], dist.getCDF(X[i]), EPS);
            }
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testObject()
        public virtual void testObject()
        {
            const double dof = 2.4;
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final StudentTDistribution dist = new StudentTDistribution(dof, ENGINE);
            StudentTDistribution dist  = new StudentTDistribution(dof, ENGINE);
            StudentTDistribution other = new StudentTDistribution(dof, ENGINE);

            assertEquals(dist, other);
            assertEquals(dist.GetHashCode(), other.GetHashCode());
            other = new StudentTDistribution(dof);
            assertEquals(dist, other);
            assertEquals(dist.GetHashCode(), other.GetHashCode());
            other = new StudentTDistribution(dof + 1, ENGINE);
            assertFalse(dist.Equals(other));
        }
Пример #3
0
        public override bool Equals(object obj)
        {
            if (this == obj)
            {
                return(true);
            }
            if (obj == null)
            {
                return(false);
            }
            if (this.GetType() != obj.GetType())
            {
                return(false);
            }
            StudentTDistribution other = (StudentTDistribution)obj;

            return(System.BitConverter.DoubleToInt64Bits(_degFreedom) == Double.doubleToLongBits(other._degFreedom));
        }
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test public void testNormal()
        public virtual void testNormal()
        {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ProbabilityDistribution<double> highDOF = new StudentTDistribution(1000000, ENGINE);
            ProbabilityDistribution <double> highDOF = new StudentTDistribution(1000000, ENGINE);
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final ProbabilityDistribution<double> normal = new NormalDistribution(0, 1, ENGINE);
            ProbabilityDistribution <double> normal = new NormalDistribution(0, 1, ENGINE);
            const double eps = 1e-4;
            double       x;

            for (int i = 0; i < 100; i++)
            {
                x = RANDOM.NextDouble();
                assertEquals(highDOF.getCDF(x), normal.getCDF(x), eps);
                assertEquals(highDOF.getPDF(x), normal.getPDF(x), eps);
                assertEquals(highDOF.getInverseCDF(x), normal.getInverseCDF(x), eps);
            }
        }