Sunrise, Sunset and the Sine Wave.

About ten years ago, or thereabouts, I was interested in using the Sine wave to calculate certain natural phenomenon. I had trigonometry in high school. And I am fascinated by anything to do with science in general.

Anyways, I used it first to calculate the average highs and lows of temperature for where I live. For some reason, this follows are fairly regular Sine wave. And so I was successful doing this.

The only thing I could never figure out was the daily sunrise and sunset times for where I lived. I tried to find the equation for this, using the times given in an almanac I had. But I was unable to find the equation. I still don’t know what it is. I just know it is not a regular Sine wave.

So what is the equation for sunrise and sunset? I really would like to know:).

https://en.wikipedia.org/wiki/Equation_of_time

I am no scientist but, curious about your question I searched for an answer and found several, including this:

The equation bob++ wrote above is basically correct. The part of it that varies over the course of the year is δ, the declination of the Sun. Various approximate expressions exist for this; if we use the simplest one, we find that the day length at a given latitude is of the form

(day length) = cos[sup]-1[/sup](A * tan(Bcos(Ct)))

where A, B, and C are constants depending on your latitude and various astronomical constants. This function oscillates, of course, but as you discovered it’s not a simple sinusoid.

For that matter, most of the other phenomena you looked at aren’t simple sinusoids, either, though they can be approximated that way. If you find the best-fit sine wave, you’ll get something pretty close, but with some error. Now subtract out your best fit so all you have left is that error, and you’ll find that you’ll be able to approximate that with another sine wave, but with twice the frequency of the original one. Subtract that out too, and you’ll have another one, with three times the frequency, and so on. Keep on doing this, and what you produce is called the Fourier decomposition of your original function.

This is true of steady state phenomena such as the apparent motion of the Sun but transient phenomena require additional factors to account for the rate of change of absolute amplitude. By combining such functions together, any non-random phenomenon can be represented (or at least approximated to a high degree of precision) in the frequency spectrum as a combination of sinusoidal and exponential functions in the manner that Chronos describes (i.e. using the Fourier transform). The really interesting thing is that if you know the characteristics of the function, it can be filtered (subtracted out) of a more complex signal, which is exactly how modern cellular telephony is able to transmit a large number of signals simultaneously in the same frequency band without interference. (Technically there is some amount of signal that is lost, but with modern filtering and anti-aliasing algorithms the losses are small and within the tolerance of reproducing a reasonably accurate audio signal.)

The other interesting thing about this is that it also explains why the discrete phenomena seen at the level of fundamental particles (as described by quantum mechanics) seems continuous at the scale of everyday experience. All fundamental particles are described as “waves of probability” in terms of position and momentum, so when you combine a large number of particles together they behave as a continuum except in very restricted circumstances where they are all coherent (in phase such that minima and maxima all occur simultaneously) as in a laser or Einstein-Bose condensate. Even supposed truly random distributions are fundamentally a composition of just a large number of discrete modes (different frequencies) that are sufficiently broadly distributed that you can’t discern the overall distribution. So, fundamentally, all phenomena can be described in terms of waves.

For the o.p., the reason the variation of high and low temperatures can be approximated as a sinusoidal periodic function is that the motion of the Earth in its orbit (which determines the length of the year) and variation of the axial tilt with respect to the Sun both have the same period, i.e. ~365 days. However, as we’re all aware, the actual period is ~365.25 days, necessitating the addition of an intercalary day every four years (with a few other adjustments). If not for this adjustment in the Gregorian calendar, you would see a very slight difference in the frequency of the year versus the temperature cycle which would manifest over a period of centuries, with winter swapping for summer about every 183 years. It is also by this means that variations in the climate over eons can be observed irrespective of local minima and maxima despite sparse data via fitting the data that we do have (or can estimate) to an expected periodic function and optimizing the parameters for best fit.

Stranger

This depends on how one defines a year. I’m aware of at least seven different definitions. Based on your figure of 183 years, it looks like you’re defining “year” as “exactly 365 days”, but if one instead uses the tropical year, it’ll stay exactly in synch with the temperature cycle, and if one uses the sidereal or apsodal year, it’ll drift relative to the temperature cycle only very slowly, since those are very close to the tropical year.

Thank you Mr. Fourier!

This fact (that any periodic function can be expressed as a series of harmonics) is one of the things that kept Aristotle’s concept of epicycles (to describe the motion of heavenly objects) alive as long as it did.

Chronos’s method essentially converts a function expressed in the time domain (x,y pairs where x is time) into one expressed in the “frequency domain”. Google “Fourier Analysis” for lots more fun!

You mean Ptolemy. (And epicycles were not sufficient for him to account for the observed planetary motions. He also needed to use eccentrics and equants.)

Can’t you just use epicycles within epicycles? And epicycles within those? I always assumed if you had enough levels of epicycles, you could get whatever accuracy you needed.

I do not know if that would be possible in principle, but it is not how it was actually done.

Actually, I kind of doubt that it can be done with just epicycles because Ptolemy’s system also used eccentric points and equants, and everybody hated equants. They were considered extremely inelegant, mathematically, but you needed them to get the theory to fit the data. If they could have got by just with more epicycles, I think they would have. Copernicus essentially invented heliocentrism simply because it enabled him to do without equants. (His system still made free use of eccentric points and epicycles - in numbers comparable to those in Ptolemy’s system - and even then he had to invent a special mechanism to account for the path of Mercury.)

First, thanks for mentioning these terms, which were new to me. Ignorance fought!

Aristotle wrote about the celestial spheres. I don’t know whether he originated that. Later, Hipparchus proposed epicycles; someone in between invented eccentrics. Ptolemy proposed equants.

According to this, Ptolemy also proposed epicycles on epicycles.

More on equants and epicycles, nicely presented so that both the dilettante (like me) and the math geek can follow. It doesn’t mention epi-epi-cycles.

In theory, any periodic function can be exactly modeled using a harmonic series, but it might need to be an infinite series, and as pointed out by njtt, it isn’t the solution used by Ptolemy (or at least, the full story). So, I may have been misled by some article that claimed that part of the success of epicycles was this equivalence. In any case, it’s not the full story.

We’d better let a math geek verify this. I know where & when I learned it, but can’t find a good cite, and I’d think that if it were this simple it’d be stated in the Wikipedia article on Fourier series, and if it is, it’s stated in terms I don’t understand well enough to recognize.

There are all sorts of decompositions of functions that are possible. As a real-world example, some of my colleagues discovered (to their annoyance) that any gravitational wave signal we might ever detect could be interpreted as being due to an appropriate collection of white dwarf binaries (which we know exist and are abundant). This means that determining that we’ve ever found anything other than a white dwarf binary via gravitational waves requires some clever heuristics to decide which is simpler, the collection of binaries or the proposed other object.

And while the full-blown Copernican model (able to exactly match all motions to within the limits of observational precision) was about as complicated as the full-blown Ptolemaic model, its real virtue was that even in its simplest form it could explain all of the qualitative observations, with no complication whatsoever: The existence of retrograde motion for some of the planets; some of the planets always staying near the Sun in the sky; the two sets of planets being disjoint; planets being brightest during retrograde motion; planets going through retrograde motion exactly when they were in opposition to the Sun. All of these are explained even in a perfect-circles, uniform-speed version of Copernicus’ model, but required at least epicycles in the Ptolemaic model (and some features, like retrograde being at opposition, aren’t explained at all by any version of the Ptolemaic model, except in an ad-hoc manner).

What I’d really love is a formula, where all I need to do is plug in a date, a latitude, and a longitude, and it will spit back the sunrise and sunset. I know there are plenty of programs and websites that can do that, but to me, they are black boxes that I cannot adapt for my own purposes.

Could someone create an Excel sheet along the following lines: I enter a date in column A. I enter a latitude in column B. I enter a longitude in column C. Columns D through X are full of ridiculously detailed formulas which build upon each other, containing all sorts of trig functions and arcane constants. Finally, column Y has sunrise and column Z has sunset.

I could probably build such a thing from the formulas in the Wiki article that I cited above, but if I made even a tiny mistake it’d be impossible for me to debug, and that’s why I hope someone else might have already done it.

Here is a algorithm from the US Naval Observatory which calculates sunrise and sunset to a reasonable degreee of precision. From the NOAA Earth System Research Lab you can download this spreadsheet to calculate sunrise and sunset, although I personally would neither use nor trust Excel to perform this calculation due to the “ridiculously detailed formulas” and inherent errors in Excel. I have a more complex application written in C and Python to cummulative caluculate solar incidence over a defined interval for a given set of climate conditions (or alternatively, regression from empirical data) but that is vastly more complex.

Stranger

Thanks for the links. The spreadsheets work fine for me; within a few seconds of the Naval Observatory times, and that’s using Gnumeric, a freeware spreadsheet that I’m surprised even had compatible function names.

Looks good! Thanks! I don’t know why I didn’t see this when you posted it, but I thank both you for posting it, and TonySinclair for the bump!