public void RTest(double jd, double expectedResult)
        {
            double result = AASVSOP87D_Jupiter.R(jd);

            Assert.Equal(expectedResult, result);
        }
Exemplo n.º 2
0
        public static double RadiusVector(double JD, bool bHighPrecision)
        {
            if (bHighPrecision)
            {
                return(AASVSOP87D_Jupiter.R(JD));
            }

            double rho        = (JD - 2451545) / 365250;
            double rhosquared = rho * rho;
            double rhocubed   = rhosquared * rho;
            double rho4       = rhocubed * rho;
            double rho5       = rho4 * rho;

            //Calculate R0
            int    nR0Coefficients = g_R0JupiterCoefficients.Length;
            double R0 = 0;
            int    i;

            for (i = 0; i < nR0Coefficients; i++)
            {
                R0 += g_R0JupiterCoefficients[i].A * Math.Cos(g_R0JupiterCoefficients[i].B + g_R0JupiterCoefficients[i].C * rho);
            }

            //Calculate R1
            int    nR1Coefficients = g_R1JupiterCoefficients.Length;
            double R1 = 0;

            for (i = 0; i < nR1Coefficients; i++)
            {
                R1 += g_R1JupiterCoefficients[i].A * Math.Cos(g_R1JupiterCoefficients[i].B + g_R1JupiterCoefficients[i].C * rho);
            }

            //Calculate R2
            int    nR2Coefficients = g_R2JupiterCoefficients.Length;
            double R2 = 0;

            for (i = 0; i < nR2Coefficients; i++)
            {
                R2 += g_R2JupiterCoefficients[i].A * Math.Cos(g_R2JupiterCoefficients[i].B + g_R2JupiterCoefficients[i].C * rho);
            }

            //Calculate R3
            int    nR3Coefficients = g_R3JupiterCoefficients.Length;
            double R3 = 0;

            for (i = 0; i < nR3Coefficients; i++)
            {
                R3 += g_R3JupiterCoefficients[i].A * Math.Cos(g_R3JupiterCoefficients[i].B + g_R3JupiterCoefficients[i].C * rho);
            }

            //Calculate R4
            int    nR4Coefficients = g_R4JupiterCoefficients.Length;
            double R4 = 0;

            for (i = 0; i < nR4Coefficients; i++)
            {
                R4 += g_R4JupiterCoefficients[i].A * Math.Cos(g_R4JupiterCoefficients[i].B + g_R4JupiterCoefficients[i].C * rho);
            }

            //Calculate R5
            int    nR5Coefficients = g_R5JupiterCoefficients.Length;
            double R5 = 0;

            for (i = 0; i < nR5Coefficients; i++)
            {
                R5 += g_R5JupiterCoefficients[i].A * Math.Cos(g_R5JupiterCoefficients[i].B + g_R5JupiterCoefficients[i].C * rho);
            }

            return((R0 + R1 * rho + R2 * rhosquared + R3 * rhocubed + R4 * rho4 + R5 * rho5) / 100000000);
        }