I'm creating a C++ program that calculates the ecliptic coordinates based on the formulae from Wikipedia But, my calculations appear off. The mean anomaly for today, for example, should be 80.4-something; both my program and Google calculate approx. 79.2 - the result of (357.528 + 0.9856003*5927) % 360 (where 5927 is the number of days since January 1, 2000, GMT)
2 Answers
Assuming that you used the time of 170900 EDT(-4 UT), which is 230900 UT, the following is my math:
Let the Julian Date for 25Mar2016 at 230900, which is 2457473.464583, be set to JD;
Given the formula (on Wikipedia:n = JD - 2451545.0 ), your n is 5928.464583. Then, taking the second formula ( g = 357.528° + 0.9856003° * n ) you get g=357.528°+5843.0964715441749 = 6200.3544715441749 mod 360 = +80.35447°. Were you to round up this would give +80.4.
Without how you handled your date/time in c++ and your rounding, I would wager that is were the error occurred.
The formulae on wikipedia are correct.
As you haven't explained where you have "80.4" from, this answer is a "best effort".
The value you have calculated is close, so there may be a small error in your code. My guess is that you haven't correctly calculated the time as a Julian Day Number. The Julian Day changes at noon UT (probably as this means that the Julian Day doesn't change during the European night) Whereas most other systems of dates start and end at midnight. This can easily introduce a 12 hour error into your calculations. When you say "number of days since Jan 1 2000, are you starting your counting at noon or midnight?