Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Tropical year

  1. May 12, 2008 #1

    jim mcnamara

    User Avatar

    Staff: Mentor

    Using this:
    I derived this unix C code, which duplicates expected outputs. Note the constant T which is a correction factor for the epoch based in 2000, or so I assume because 2451545 is Jan 1 2000. And I have about epochs in calculations.


    1. I'm not an astronomer, where do I find similar T values for past times?

    2. How far back in time does the algorithm below "work"? From: Lyle Huber at nmsu:

    Code (Text):

    #include <stdlib.h>
    #include <float.h>
    #include <stdio.h>

    double tropical_year(const double JD)
        const double T= (JD - 2451545.)/ 36526.;  /* use epoch 2000 */
        double T2=T * T;
        double T3=T2 * T;
        double result=365.2421896698 -(.00000615359 *T)
                                     -(7.29e-10 * T2)
                                     +(2.64e-10 *T3);
        return result;

    int process(const double JD)
        int retval=0;
        if(JD > DBL_EPSILON)
            printf("JD %.2f  Tropical year:%.6f\n", JD, tropical_year(JD));
            printf("JD %f  Tropical year:undefined\n", JD);
        return retval;

    int main(int argc, char **argv)
        int retval=0;
        double JD=0.;
        if(argc>1) /* read arg list */
            int i=0;
            for(i=1; i < argc; i++)
        else /* read from stdin */
            char tmp[128]={0x0};
            while(fgets(tmp, sizeof(tmp), stdin)!=NULL)
        return 0;
    Last edited by a moderator: Apr 23, 2017
  2. jcsd
Share this great discussion with others via Reddit, Google+, Twitter, or Facebook

Can you offer guidance or do you also need help?
Draft saved Draft deleted