
William W. answered 08/08/21
Experienced Tutor and Retired Engineer
The biggest issue (I think) is all the data on the website and the conversion of it into useful data. If you're good at Excel, you can convert it there. Otherwise, perhaps find some key points to use.
A sinusoidal can be either a sine function or a cosine function. This data starts near the minimum and goes up then down and, to me, is closest to a negative cosine function. However, since the minimum occurs in December of the previous year, and we don't have the data for that, I'm going to suggest we just use a positive cosine function and shift it to the right. So I'll pick that as my baseline. The generic function would then be:
y = Acos[B(x - C)] + D where A is the amplitude, B is 2π/period, C is the horizontal shift, and D is the vertical shift (midline).
Find the longest day length. Looks like Sat Jun 20, 2020 has 15 hours, 22 minutes, 26 seconds. Convert the day (Sat Jun 20) to the number (1 - 366) as instructed. Looks like day # 172 to me. Then convert the hours:minutes:seconds into decimal hours. 22 minutes is 22/60 or 0.36666666 hours. 26 seconds is 26/3600 or 0.00722222 hours. Add them up to get 15.37388889 hours
The find the shortest day length. Looks like Mon Dec 21 is the winner with 9 hours, 6 minutes, 1 second or 9 + 6/60 + 1/3600 = 9.100277778 hours. The day designator looks like day # 356 to me.
So the amplitude and midline can now be calculated. The midline (vertical shift) is the average of the max and min. So midline D = (15.37388889 + 9.100277778)/2 = 12.23708333
The amplitude is the difference of the max (or min) and the midline so A = 15.37388889 - 12.23708333 = 3.13680556.
To calculate B, we need the period. It seems as though the period should be 1 year. But lets see based on our data. If day #172 is the max and day #356 is the min then half of the period is 356-172 = 184 and 184•2 = 368 so I guess we need to use a value slightly longer than a year to model this data. Then B = 2π/368 = π/184.
The Horizontal shift then comes from day #172 and so C = 172.
That means we have A = 3.13680556, B = π/184, C = 172, and D = 12.23708333 or:
y = 3.13680556cos[π/184(x - 172)] + 12.23708333
To see how good we did, let's pick day #1. Plugging that into the equation we get 9.1772306 hours. The website says 9 hours 10 minutes 2 seconds. Converting that to decimal, we get 9 + 10/60 + 2/3600 = 9.1672222 which is about 1/10 of a percent off. Let's try March 20 (day #80). The equation says 12.23708333 hours and the website says 12 hours 13 minutes 34 seconds which converts to 12 + 13/60 + 34/3600 = 12.2261111 which is about 0.09% off. Day #172 and Day # 356 should be right on the money.
It may be more accurate overall to use B = 2π/365.25