I am writing a small application converting JPL data to geocentric data (ftp: //ssd.jpl.nasa.gov /pub /eph/ planets/).

For julian date 2419808.5 (10/feb/1913), I get the following geocentric
euclidian coordinates for the Sun:

X computed=0,776527519339687 expected=0,776527519339687 diff=0
Y computed=-0,558825118634278 expected=-0,558825118634278 diff=0
Z computed=-0,24239694271189 expected=-0,24239694271189 diff=0

I am checking my results against those computed by the Java code provided by JPL.

When I convert these coordinates to spherical coordinates, I get:

Sun RA computed=1.0705143245740283 expected=5.596728110839562
Sun Decl computed=-5.854870967902723 expected=-1.197489792340554E-7
Sun r computed=0.9869330166452706 expected=0.986933037

I am comparing my results to those generated by the Swiss Eph test page using the JPL 406 option.

Notice that the difference for R is close to 0. This is true for all astral
items I am computing. However, RA and Decl value are not correct.

I have read about Nutation (see http: // www .cv .nrao .edu ~rfisher/ Ephemerides/ earth_rot.html#topo ) and implemented the recommended corrections, but it does not solve the issue.

I am convinced my issue lies in the conversion between euclidian and spherical coordinates. The formulas I use are:

double R = Math.sqrt( X*X + Y*Y + Z*Z );
double RA = Math.atan(Y/X);
double Decl = Math.atan( Z / Math.sqrt( X*X + Y*Y ) );

Are these correct? If not, what are the correct formulas? I believe JPL generates equatorial coordinates? Do I need to make them ecliptic to compare them to swiss eph test data? Is there another reliable online website providing reference geocentric data?

I am a newbie. Help and pointers are welcome.