I am currently working on an algorithm to compute planetary positions using Kepler's law. As I was testing it against the ephemeride service supplied by https://ssd.jpl.nasa.gov/horizons.cgi, I found the true anomaly to be correct, however the distance was off by 1%, so I wonder if there is something wrong with the distance supplied by the service, or if I computed the distance incorrectly?
The values are concerned with Mercury on Jan 1 2000, 00:00.
To get the orbital elements, you enter the following settings:
Ephemeris type: ELEMENTS
Target body: Mercury
Coordinate origin: 10 (this is the body ID of the sun, which will be the coordinate center)
Time Span: Start=2000-01-01 00:00, Stop=2000-01-01 01:00, Step=1
Table settings: default
Display/output: default
The result shows that on the given time (Jan 1 2000 00:00), the elements was as follows:
true anomaly: 1.751155303115542E+02 (degrees)
semi-major axis: 3.870982252717257E-01 (AU)
eccentricity: 2.056302512089075E-01
If you use these three values to compute the distance $r$, using the formula $$r=\frac{a(1-e^2)}{1 + e\cdot\cos(v)}$$ where $a$ is the semi-major axis, $e$ is eccentricity and $v$ is true anomaly, you get a result of about 0.466 AU.
But if you instead request the distance from the site by changing ephemeris type from ELEMENTS to VECTORS, you get the distance (as indicated by value RG) to 0.47 AU.
I'm very confounded by this, and I hope someone can shine some light on this mystery.