<p>There are two reasons the real azimuth is different from the theoretical sine curve:</p>
<ol>
<li>The real azimuth is sinusoidal (like a sine curve) but not exactly a sine curve. More information is given below.</li>
<li>The real azimuth is a function of the ecliptic longitude (and other &quot;constants&quot;; see below). The ecliptic longitude does not increase at a uniform rate because of the eccentricity of the Earth's orbit. The date increases uniformly in the sine curve formula. The two curves are not &quot;in synch&quot;.</li>
</ol>
<p>For the first item, the real azimuth can be calculated from
<span class="math-container">$$\text{azimuth}=180-A\cos(c\sin(\lambda))$$</span>
where <span class="math-container">$c=-\sin(\epsilon)/\cos(\text{latitude})$</span>, <span class="math-container">$\epsilon$</span> is the angle of obliquity (approximately 23.44 degrees) and <span class="math-container">$\lambda$</span> is ecliptic longitude. If you use the ecliptic longitude to graph the real azimuth versus the theoretical sine curve, you will see the real azimuth is sinusoidal but not exactly the same as the sine curve.</p>
<p>Note: The ecliptic longitude increases from 0 starting from the March equinox.</p>

CC BY-SA 4.0
2021-11-05T03:42:55.980Z
2022-04-04T05:40:12.367Z
2022-04-04T05:40:12.367Z
JohnHoltz
<p>I want to know how the sun's azimuth at sunset changes over the course of a year.</p>
<p>At first, I thought it would have purely sinusoidal motion, hitting its maxima and minima at the solstices, and hitting due west at the equinoxes.  But, I learned soon after that about the analemma, and wanted to see how the actual data would differ from a simple sine function.</p>
<p>I computed the sunset azimuth for each day in 2021 at latitude 47°N using the <a href="https://astral.readthedocs.io/en/latest/index.html" rel="nofollow noreferrer">Astral python package</a>, and plotted it against this sine function, where day of summer solstice is 170, the number of the day counting from January 1 on which the summer solstice falls:</p>
<p><span class="math-container">$$
\text{azimuth}_\text{expected} = \frac{\text{azimuth}_\text{max} - \text{azimuth}_\text{min}}{2} \cdot \cos \left( \frac{2\pi}{365} \cdot d + d_\text{summer solstice} \right) + \frac{\text{azimuth}_\text{max} + \text{azimuth}_\text{min}}{2}
$$</span></p>
<p>(Note: this should really be subtracting the day # of the summer solstice for phase shift, but this is what worked out for me since the Y axis is reversed in p5.js.)</p>
<p>This is what I got when I plotted the two against each other, from Jan 1 to Dec 31.  No axes, because i originally conceived of this project in p5.js and it was taking too long.  Expected azimuth from the sine function is dark green, and observed azimuth is fuchsia:</p>
<p><a href="https://i.sstatic.net/IXnfc.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/IXnfc.png" alt="actual vs expected" /></a></p>
<p>And this is what I got when I plotted the difference between observed and predicted azimuth, again from Jan 1 to Dec 31:</p>
<p><a href="https://i.sstatic.net/HaEvL.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/HaEvL.png" alt="difference" /></a></p>
<p>I was surprised at first, because I expected this to more or less match with the equation of time:</p>
<p><a href="https://i.sstatic.net/eiz1Q.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eiz1Q.png" alt="equation of time" /></a></p>
<p>But the equation of time has two minima and maxima, and my plot has three.  At first I thought my data was wrong, but data from sunset.js corroborated my findings.</p>
<p>What accounts for this difference?  The reasons I can think of are:</p>
<ol>
<li>The analemma will be tilted by some degrees at the horizon, and I haven't accounted for that.</li>
<li>The sine function I have is not the right thing to plot against.</li>
</ol>
<p><a href="https://editor.p5js.org/gwd/sketches/GJq6YRUII" rel="nofollow noreferrer">Here's the p5.js sketch</a> if you'd like to poke around, and keep in mind the y-axis is reversed in p5.js.</p>

CC BY-SA 4.0
2021-11-03T18:07:14.243Z
Can you provide the exact equation you are using for "a sine function with a period of 365 days and an amplitude of half the azimuth difference". (Not a direct quote of the MathJax but close :-). One problem may be that the real equation is cos(azimuth)=c1*sin(ecliptic longitude), and you are comparing that to azimuth=c2*sin(ecliptic longitude). Those two equations give different values for azimuth (if you measure azimuth from due south). Another issue is the ecliptic longitude does not increase uniformly like the date does due to the eccentricity of the Earth's orbit.
JohnHoltz
CC BY-SA 4.0
2021-11-03T19:31:31.117Z
@JohnHoltz added!
Greg
CC BY-SA 4.0
2022-04-04T14:50:19.137Z
This may not answer your question directly, but this padge explores a lot of the parameters that affect the analemma.https://mtirado.com/blog/demystifying-the-analemma/
Greg Miller
<the-sun><horizon><azimuth><sunset><analemma>
What is the relationship between the shape of the analemma and the sun's azimuth at sunset at a given latitude?
Greg
# What is the relationship between the shape of the analemma and the sun's azimuth at sunset at a given latitude?

(Asked by: username_0 on 2021-11-03)

I want to know how the sun's azimuth at sunset changes over the course of a year.

At first, I thought it would have purely sinusoidal motion, hitting its maxima and minima at the solstices, and hitting due west at the equinoxes. But, I learned soon after that about the analemma, and wanted to see how the actual data would differ from a simple sine function.

I computed the sunset azimuth for each day in 2021 at latitude 47°N using the [Astral python package](https://astral.readthedocs.io/en/latest/index.html), and plotted it against this sine function, where day of summer solstice is 170, the number of the day counting from January 1 on which the summer solstice falls:

$$
\text{azimuth}\_\text{expected} = \frac{\text{azimuth}\_\text{max} - \text{azimuth}\_\text{min}}{2} \cdot \cos \left( \frac{2\pi}{365} \cdot d + d\_\text{summer solstice} \right) + \frac{\text{azimuth}\_\text{max} + \text{azimuth}\_\text{min}}{2}
$$

(Note: this should really be subtracting the day # of the summer solstice for phase shift, but this is what worked out for me since the Y axis is reversed in p5.js.)

This is what I got when I plotted the two against each other, from Jan 1 to Dec 31. No axes, because i originally conceived of this project in p5.js and it was taking too long. Expected azimuth from the sine function is dark green, and observed azimuth is fuchsia:

[![actual vs expected](https://i.sstatic.net/IXnfc.png)](https://i.sstatic.net/IXnfc.png)

And this is what I got when I plotted the difference between observed and predicted azimuth, again from Jan 1 to Dec 31:

[![difference](https://i.sstatic.net/HaEvL.png)](https://i.sstatic.net/HaEvL.png)

I was surprised at first, because I expected this to more or less match with the equation of time:

[![equation of time](https://i.sstatic.net/eiz1Q.png)](https://i.sstatic.net/eiz1Q.png)

But the equation of time has two minima and maxima, and my plot has three. At first I thought my data was wrong, but data from sunset.js corroborated my findings.

What accounts for this difference? The reasons I can think of are:

1. The analemma will be tilted by some degrees at the horizon, and I haven't accounted for that.
2. The sine function I have is not the right thing to plot against.

[Here's the p5.js sketch](https://editor.p5js.org/gwd/sketches/GJq6YRUII) if you'd like to poke around, and keep in mind the y-axis is reversed in p5.js.

**Tags:** the-sun, horizon, azimuth, sunset, analemma

> **Comments:**
> **username_1**: Can you provide the exact equation you are using for "a sine function with a period of 365 days and an amplitude of half the azimuth difference". (Not a direct quote of the MathJax but close :-). One problem may be that the real equation is cos(azimuth)=c1*sin(ecliptic longitude), and you are comparing that to azimuth=c2*sin(ecliptic longitude). Those two equations give different values for azimuth (if you measure azimuth from due south). Another issue is the ecliptic longitude does not increase uniformly like the date does due to the eccentricity of the Earth's orbit.  
> **username_0**: @username_1 added!  
> **username_2**: This may not answer your question directly, but this padge explores a lot of the parameters that affect the analemma.https://mtirado.com/blog/demystifying-the-analemma/  

---

## 1 answers

### Answer by username_1 on 2021-11-05. Score: 1 | Accepted answer

There are two reasons the real azimuth is different from the theoretical sine curve:

1. The real azimuth is sinusoidal (like a sine curve) but not exactly a sine curve. More information is given below.
2. The real azimuth is a function of the ecliptic longitude (and other "constants"; see below). The ecliptic longitude does not increase at a uniform rate because of the eccentricity of the Earth's orbit. The date increases uniformly in the sine curve formula. The two curves are not "in synch".

For the first item, the real azimuth can be calculated from
$$\text{azimuth}=180-A\cos(c\sin(\lambda))$$
where $c=-\sin(\epsilon)/\cos(\text{latitude})$, $\epsilon$ is the angle of obliquity (approximately 23.44 degrees) and $\lambda$ is ecliptic longitude. If you use the ecliptic longitude to graph the real azimuth versus the theoretical sine curve, you will see the real azimuth is sinusoidal but not exactly the same as the sine curve.

Note: The ecliptic longitude increases from 0 starting from the March equinox.


---

