Failure to calculate equation of time and declination of the sun

Click For Summary

Discussion Overview

The discussion revolves around the challenges faced in calculating the equation of time and the declination of the sun, with a focus on coding errors and debugging in a computational context.

Discussion Character

  • Technical explanation
  • Mathematical reasoning
  • Homework-related

Main Points Raised

  • Dwayne reports unexpected values in the calculations for the equation of time and sun's declination, indicating specific failures in test cases.
  • There is a question about whether trigonometric functions are being calculated in radians or degrees, which could affect the results.
  • Dwayne mentions adding a degrees to radians converter, but notes that the equation of time calculation has become significantly inaccurate.
  • After realizing a mistake regarding the conversion of the sun's mean longitude, Dwayne reports improvement but still notes discrepancies in the expected values.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the source of the errors, and multiple competing views on potential causes remain unresolved.

Contextual Notes

Limitations include potential misunderstandings regarding angle conversions and the specific implementation of trigonometric functions in the code.

dwaynie
Messages
9
Reaction score
0
Calculating the equation of time and the declination of the sun

Hi,

I'm trying to calculate the equation of time and the declination of the sun in the prettiest way possible:

https://gist.github.com/1278755"

But right now I'm getting some unexpected values:

Code:
1) Failure:
test_suns_declination(TestSolarCalculations):
Expected -3.18, not -0.8773192601265396.

2) Failure:
test_equation_of_time(TestSolarCalculations):
Expected 2011-10-01 10:23:00 +0100, not 301.80925318673167.

Can anybody see what's wrong?

--Dwayne
 
Last edited by a moderator:
Astronomy news on Phys.org
Getting closer, still one month off though:

Code:
1) Failure:
test_equation_of_time(TestSolarCalculations):
Expected 2011-10-01 10:23:00 UTC, not 2011-10-28 17:02:35 UTC.

2) Failure:
test_suns_declination(TestSolarCalculations):
Expected -3.18, not 1.380604820284565.
 
When your computer calculates sine and cosine, is it calculating trig functions for an angle in radians or an angle in degrees?

(Excel, for example, has to have the angles converted into radians before calculating the sine or cosine.)
 
Cool! So I added a degrees to radians converter. But whereas my declination of the sun is getting really close, my equation of time has gotten way off by 10 months!

Code:
1) Failure:
test_equation_of_time(TestSolarCalculations):
Expected 2011-10-01 10:23:00 UTC, not 2011-01-06 01:08:11 UTC.

2) Failure:
test_suns_declination(TestSolarCalculations):
Expected -3.18, not -3.2087920449753007.

Any ideas? I hope my script remains readable.

https://gist.github.com/1278755"

Have you seen this by the way?

http://www.youtube.com/watch?v=y2R3FvS4xr4"

--Dwayne
 
Last edited by a moderator:
I realized I forgot to convert my sun's mean longitude back to degrees before calculating the equation of time. Now I'm back to being just a month off.

Code:
1) Failure:
test_equation_of_time(TestSolarCalculations):
Expected 2011-10-01 10:23:00 UTC, not 2011-10-28 10:59:31 UTC.

2) Failure:
test_suns_declination(TestSolarCalculations):
Expected -3.18, not -3.2087920449753007.

--Dwayne
 

Similar threads

  • · Replies 15 ·
Replies
15
Views
5K
Replies
1
Views
3K
  • · Replies 7 ·
Replies
7
Views
6K
  • · Replies 2 ·
Replies
2
Views
5K
Replies
3
Views
3K
  • · Replies 1 ·
Replies
1
Views
8K
  • · Replies 4 ·
Replies
4
Views
5K
Replies
6
Views
2K
  • · Replies 1 ·
Replies
1
Views
1K
  • · Replies 0 ·
Replies
0
Views
3K