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?
Edit/Added 05/16/2016:
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.
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,
The corresponding plot is the following one, which seems more likely: