<p>I have to subtract these years:</p>
<ul>
<li>2010, 2009, 2008, 2007, 2006, 2005, 2004</li>
</ul>
<p>Because 2003 it isn't finished yet.</p>
<p>My problem was the word <em>since</em> because I don't understand it if I have to do it backward.</p>

CC BY-SA 4.0
2021-06-28T13:29:19.163Z
2021-06-28T13:29:19.163Z
VansFannel
<p>You shouldn't add 2010 because the date of interest is before 2010. None of the days in 2010 were in the time between 27 July 2003 and 0000 1 January 2010. Similarly, the time after 27 July 2003 until the end of the year isn't a complete year so you don't add it. That leaves you with the six whole years 2004 to 2009, 2 of them are leap years. 2192 days. The book's example should go on after that step to figuring the number of days 27 July to 31 December, inclusive.</p>

CC BY-SA 4.0
2021-06-26T06:58:17.040Z
`+1` can you double-check that I've done it that way in [my answer](https://astronomy.stackexchange.com/a/44547/7982)? I'm not very confident. *Thanks!*
uhoh
CC BY-SA 4.0
2021-06-26T22:36:30.447Z
@uhoh I don't see a conflict. You do have a typo - two years 2006, but it's just a typo. Your year 2004, which should be the earliest full year,  shows 6 years with 2 of them leap years, just like I said.
stretch
CC BY-SA 4.0
2021-06-27T00:49:18.083Z
Thanks, I'm [prone to errors](https://math.stackexchange.com/questions/4181503/ray-tracing-in-nonuniform-media-did-i-write-this-second-order-differential-equa#comment8667501_4181503) so I appreciate the confirmation.
uhoh
CC BY-SA 4.0
2021-06-25T14:39:37.420Z
2021-06-25T14:39:37.420Z
stretch
<p><a href="https://en.wikipedia.org/wiki/Leap_year#Gregorian_calendar" rel="nofollow noreferrer">Leap year; Gregorian calendar</a>:</p>
<blockquote>
<p>Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. For example, the years 1700, 1800, and 1900 are not leap years, but the years 1600 and 2000 are.</p>
</blockquote>
<p><strong>Following the instructions as you have quoted them</strong> <em>which may or may not be correct:</em></p>
<blockquote>
<p>Add 365 days for every year since 2010 plus 1 extra day for every leap year (see Table 2). The result is D. (Note that we subtract the total in this case as 2003 is before 2010.)</p>
</blockquote>
<p>I get:</p>
<pre><code>1996     -365*14 - 3        leap year
1997     -365*13 - 2
1998     -365*12 - 2
1999     -365*11 - 2
2000     -365*10 - 2        leap year (skip divisible by 100 but leap divisible by 400!)
2001     -365*9  - 2
2002     -365*8  - 2
2003     -365*7  - 2
2004     -365*6  - 2        leap year
2005     -365*5  - 1
2006     -365*4  - 1
2007     -365*3  - 1
2008     -365*2  - 1        leap year
2009     -365*1  - 0
2010     +0
2011     +365*1  + 0
2012     +365*2  + 1        leap year
2013     +365*3  + 1
2014     +365*4  + 1
2015     +365*5  + 1
2016     +365*6  + 2        leap year
2017     +365*7  + 2
2018     +365*8  + 2
2019     +365*9  + 2
2020     +365*10 + 3        leap year
</code></pre>

CC BY-SA 4.0
2021-06-25T08:18:59.303Z
2021-06-27T00:47:23.860Z
2021-06-27T00:47:23.860Z
uhoh
<p>I'm reading the book &quot;<a href="https://rads.stackoverflow.com/amzn/click/com/B00E3UR5FQ" rel="nofollow noreferrer" rel="nofollow noreferrer">Practical Astronomy with your Calculator or Spreadsheet 4th Edition</a>&quot; implementing its formulas with C++.</p>
<p>Now, I'm implementing formula 46 &quot;<strong>Calculating the position of the Sun</strong>&quot; and the first thing they do is define the epoch on which they shall base our calculations. They have chosen 2010 January
0.0 (JD = 2455196.5).</p>
<p>In the book there is an example asking: &quot;what were the right ascension and declination of the
Sun at 0hUT on Greenwich date 27 July 2003?&quot;</p>
<p>In the second step to calculate that, they say:</p>
<blockquote>
<p>Add 365 days for every year since 2010 plus 1 extra day for every leap
year (see Table 2). The result is D. (Note that we subtract the total
in this case as 2003 is before 2010.)</p>
</blockquote>
<p>But I don't know, and this is my question, which years do I have to add? I have three options:</p>
<ul>
<li>2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003.</li>
<li>2010, 2009, 2008, 2007, 2006, 2005, 2004.</li>
<li>2009, 2008, 2007, 2006, 2005, 2004, 2003.</li>
</ul>
<p>Which are the years that I have to add?</p>

CC BY-SA 4.0
2021-06-25T08:30:26.917Z
Before you attempt to calculate the position of the Sun I would advise you to take a look at these planetary ephemerides, which include our mother star circumstances between 2011 and 2030. http://astropixels.com/ephemeris/ephemeris.html They are loose, but you can easily export them to MS Excel. Read the article below on how to do it: http://www.mkrgeo-blog.com/the-astropixels-com-ephemeris-data-extractor/ https://www.youtube.com/watch?v=EOIlprYCi6Y&t=2s&ab_channel=MariuszKrukar or alternatively use the `INDEX(IMPORTHTML)` formula in Google Sheets https://www.youtube.com/watch?v=07Bm03b0Yhs&ab
Geographos
CC BY-SA 4.0
2021-06-25T18:56:33.743Z
Do you want to know the future position of the sun wrt the stars at a fixed position of earth wrt to the sun?
Deschele Schilder
CC BY-SA 4.0
2021-06-25T22:52:54.233Z
Why don't you use library functions to calculate the number of days since the epoch date? Eg, https://stackoverflow.com/a/31928010/4014959
PM 2Ring
<the-sun><positional-astronomy>
Calculating the position of the Sun
VansFannel
# Calculating the position of the Sun

(Asked by: username_0 on 2021-06-25)

I'm reading the book "[Practical Astronomy with your Calculator or Spreadsheet 4th Edition](https://rads.stackoverflow.com/amzn/click/com/B00E3UR5FQ)" implementing its formulas with C++.

Now, I'm implementing formula 46 "**Calculating the position of the Sun**" and the first thing they do is define the epoch on which they shall base our calculations. They have chosen 2010 January
0.0 (JD = 2455196.5).

In the book there is an example asking: "what were the right ascension and declination of the
Sun at 0hUT on Greenwich date 27 July 2003?"

In the second step to calculate that, they say:

> Add 365 days for every year since 2010 plus 1 extra day for every leap
> year (see Table 2). The result is D. (Note that we subtract the total
> in this case as 2003 is before 2010.)

But I don't know, and this is my question, which years do I have to add? I have three options:

* 2010, 2009, 2008, 2007, 2006, 2005, 2004, 2003.
* 2010, 2009, 2008, 2007, 2006, 2005, 2004.
* 2009, 2008, 2007, 2006, 2005, 2004, 2003.

Which are the years that I have to add?

**Tags:** the-sun, positional-astronomy

> **Comments:**
> **username_1**: Before you attempt to calculate the position of the Sun I would advise you to take a look at these planetary ephemerides, which include our mother star circumstances between 2011 and 2030. http://astropixels.com/ephemeris/ephemeris.html They are loose, but you can easily export them to MS Excel. Read the article below on how to do it: http://www.mkrgeo-blog.com/the-astropixels-com-ephemeris-data-extractor/ https://www.youtube.com/watch?v=EOIlprYCi6Y&t=2s&ab_channel=MariuszKrukar or alternatively use the `INDEX(IMPORTHTML)` formula in Google Sheets https://www.youtube.com/watch?v=07Bm03b0Yhs&ab  
> **username_2**: Do you want to know the future position of the sun wrt the stars at a fixed position of earth wrt to the sun?  
> **username_3**: Why don't you use library functions to calculate the number of days since the epoch date? Eg, https://stackoverflow.com/a/31928010/4014959  

---

## 3 answers

### Answer by username_0 on 2021-06-28. Score: 0 | Accepted answer

I have to subtract these years:

* 2010, 2009, 2008, 2007, 2006, 2005, 2004

Because 2003 it isn't finished yet.

My problem was the word *since* because I don't understand it if I have to do it backward.


---

### Answer by username_4 on 2021-06-25. Score: 3

You shouldn't add 2010 because the date of interest is before 2010. None of the days in 2010 were in the time between 27 July 2003 and 0000 1 January 2010. Similarly, the time after 27 July 2003 until the end of the year isn't a complete year so you don't add it. That leaves you with the six whole years 2004 to 2009, 2 of them are leap years. 2192 days. The book's example should go on after that step to figuring the number of days 27 July to 31 December, inclusive.

> **Comments:**
> **username_5**: `+1` can you double-check that I've done it that way in [my answer](https://astronomy.stackexchange.com/a/44547/7982)? I'm not very confident. *Thanks!*  
> **username_4**: @username_5 I don't see a conflict. You do have a typo - two years 2006, but it's just a typo. Your year 2004, which should be the earliest full year,  shows 6 years with 2 of them leap years, just like I said.  
> **username_5**: Thanks, I'm [prone to errors](https://math.stackexchange.com/questions/4181503/ray-tracing-in-nonuniform-media-did-i-write-this-second-order-differential-equa#comment8667501_4181503) so I appreciate the confirmation.  

---

### Answer by username_5 on 2021-06-25. Score: 3

[Leap year; Gregorian calendar](https://en.wikipedia.org/wiki/Leap_year#Gregorian_calendar):

> Every year that is exactly divisible by four is a leap year, except for years that are exactly divisible by 100, but these centurial years are leap years if they are exactly divisible by 400. For example, the years 1700, 1800, and 1900 are not leap years, but the years 1600 and 2000 are.

**Following the instructions as you have quoted them** *which may or may not be correct:*

> Add 365 days for every year since 2010 plus 1 extra day for every leap year (see Table 2). The result is D. (Note that we subtract the total in this case as 2003 is before 2010.)

I get:

```
1996     -365*14 - 3        leap year
1997     -365*13 - 2
1998     -365*12 - 2
1999     -365*11 - 2
2000     -365*10 - 2        leap year (skip divisible by 100 but leap divisible by 400!)
2001     -365*9  - 2
2002     -365*8  - 2
2003     -365*7  - 2
2004     -365*6  - 2        leap year
2005     -365*5  - 1
2006     -365*4  - 1
2007     -365*3  - 1
2008     -365*2  - 1        leap year
2009     -365*1  - 0
2010     +0
2011     +365*1  + 0
2012     +365*2  + 1        leap year
2013     +365*3  + 1
2014     +365*4  + 1
2015     +365*5  + 1
2016     +365*6  + 2        leap year
2017     +365*7  + 2
2018     +365*8  + 2
2019     +365*9  + 2
2020     +365*10 + 3        leap year

```


---

