# Trig Formula for distance

I found a formula for calculating the distance to the sun for any given day of the year. The formula uses the cosine function and I am not able to calculate the distances correctly. I fear it is my misunderstanding of the formula or cosine. I need help determining where my math is incorrect.

Formula:
r = a(1-e*e)/(1+e cos(θ))

a = Semi Major Axis of Orbit = 149.6 kilometers
e = eccentricity of Earth orbit is .01672
θ = Theta = # of days since last perihelion * 365.25/360

Solved for May 22, 2002. Perihelion was on Jan 2, 2002. (140 days.)
I know the answer should be around 151 million kilometers for that day.
And that is about 1.3% farther than the mean of 149.6.

r = 149.6(1-.01672 * .01672) / (1 + e * cos(140 * (365.25/360))

r = 149.6 * (.98328 * .01672) / (1.01672 * cos(140 * (1.01583))

r = 149.6 * (.01644) / (1.01672 * cos(142.2162))

r = 2.459424 / (1.01672 * .79033)

r = 2.459424 / .8035443176

r = 3.0607

???? Where is my misunderstanding?

Great Answer AugSB! I was overlooking the radians conversion. It works great now. Thank you so much. For anyone else needing similar calculations here is the Excel formula developed by AugSB:

=149.6*(1-(0.01672*0.01672))/(1+(0.01672*COS(B3*(365.25/360)*(PI()/180))))

• where column "B" holds the number of days since last perihelion.
• it should also be noted that this formula assumes the Earth's orbit is a perfect circle in which the Earth travels the same amount each day. The orbit is actually oblong and travels slightly faster in orbit when nearer to the Sun. So these numbers are not exact. Another Method to account for Kepler's theory can be used, but it is way over my head. NASA has an applet that can get exact distances at the following link.

http://ssd.jpl.nasa.gov/horizons.cgi

• In the denominator, you've calculated $(1 + e)\cos(\theta)$, is this what you intended, or should it have been $1 + e\cos{\theta}$? – ÍgjøgnumMeg May 13 '16 at 15:48

You computed $(1-e)\cdot e$ instead of $1-(e\cdot e)$. While the latter gives you a number close to $1$ (because $e$ close to $0$), the former is closer to $e$ and, hence, to $0$. Similarly, you computed $(1+e)\cos(θ)$ instead of $1+(e\cos(θ))$.

The result, according to the formula and the data you gave, is 151.54 million kilometers.

Edit:

I have ploted the formula you wrote in your question and it seems that the periodicity of the distance is too small: I would say that the problem is that you are computing $\cos$ function with degrees instead of radians. Try to use the following formula: $$r = a\cdot\frac{1-e^2}{1+e\cdot\cos\left(t\cdot\frac{365.25}{360}\cdot\frac{\pi}{180}\right)},$$ that is,

r = a*(1-(e*e))/(1+(e*cos(t*(365.25/360)*(pi/180))))


The corresponding plot is the following one, which seems more likely: • Yes! Thank you. I'm afraid my last trig class was many years ago. So judging by your corrections the correct formula - at least that works in excel (for 140 days past perihelion) should be (149.6*(1-0.01672*0.01672))/(1+(0.01672 * COS(142.04))) – John Muggins May 13 '16 at 17:11
• That's correct! – AugSB May 13 '16 at 19:00
• After review I found that the formula is still wrong. I calculated the same formula with each day of the year and found the numbers are off. For example, day 4 of the year also gives roughly 151 million kilometers form the sun. That just can't be. The Sun is much closer nearer to perihelion. Here is the revised formula I tried in excel where 4 is the days since perihelion:<BR><P>=149.6*(1-(0.01672 * 0.01672)) / (1 + (0.01672 * COS(4 * (365.25/360))))<P>I'm beginning to think this formula may not be good itself. – John Muggins May 16 '16 at 13:35
• I think I found the problem. See my edit on the answer. – AugSB May 16 '16 at 13:50
• Spot on AugSB ! I was overlooking the radians conversion. Excellent! I'm running a 10 year spreadsheet - by day - with distances to the Sun and Moon on those given days, hoping to correlate lunar and solar gravity somehow to weather patterns on earth. For any one else doing similar calculations - here is my excel formula with help from AugSB: [code]= 149.6*(1-(0.01672*0.01672))/(1+(0.01672*COS(B3*(365.25/360)*(PI()/180))))[/code] – John Muggins May 16 '16 at 18:48