| TIP: Click on subject to list as thread! | ANSI |
| echo: | |
|---|---|
| to: | |
| from: | |
| date: | |
| subject: | Equation of Time |
I dug out that program that calculates the Equation of Time. Actually,
this is a demo program. The calculation is done in the little function
Equt, at the end of the program, which is only a few lines long. The
rest of the program shows how accurate it is, compared with published
values.
It's in QBasic, which is a bit antiquated these days, but aren't we
all?!
More later...
-------------------------------------------
' EQUTIME.BAS
' David Williams, 2003
' david.williams{at}ablelink.org
' This version dated 2003 June 16
' Compares results of (home brewed) Equation of Time calculation
' (in function Equt) with published values.
' Equation of Time is difference between Solar Time and Mean Time.
' Sundials show solar time. Clocks show mean time.
' Published values are from the book:
' Sundials, Their Theory and Construction
' by Albert E. Waugh
' Dover Publications, New York, 1973
' ISBN 0-486-22947-5
DECLARE FUNCTION Equt! (D!)
DIM ML(1 TO 13)
FOR X = 1 TO 13
READ ML(X)
NEXT
DATA 33,29,33,31,33,31,33,33,31,33,31,33,0
' Month lengths adjusted for numbers of pixels on screen
DATA 3.12,7.38,11.08,13.33,14.19,13.49,12.34,10.18,7.28
DATA 4.08,1.16,-1,-2.51,-3.4,-3.34,-2.25,-.39,1.28
DATA 3.33,5.16,6.15,6.16,5.14,3.16,.12,-3.08,-6.4
DATA -10.05,-13.02,-15.12,-16.2,-16,-14.16,-11.11,-7.02,-2.13
' Above data show published values of Equation of Time on
' 1st, 11th and 21st days of months. Decimal point separates
' minutes, to left, from seconds, to right, e.g. 3.16 means
' 3 minutes and 16 seconds. Seconds are multiplied by 5/3 to
' get fractional minutes after READ instruction.
' Set up graph
SCREEN 12
CL0 = 7: CL1 = 14: CL2 = 11 ' colours used
CLS
COLOR CL0
PRINT TAB(30); "EQUATION OF TIME"
LOCATE 3, 15
PRINT "Graph shows difference in minutes between clock"
PRINT TAB(15); "and sundial time. Positive difference means"
PRINT TAB(15); "clock is ahead of sundial, and vice versa."
LOCATE 16, 67
PRINT "-=";
FOR T = -20 TO 15 STEP 5
LINE (137, 247 - 6.4 * T)-(530, 247 - 6.4 * T)
LOCATE 16 - T / 2.5, 14
PRINT RIGHT$(" " + STR$(T), 3);
IF T = 0 THEN PRINT " =";
NEXT
LOCATE 9, 20
PRINT "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec";
' Do graphing
T = 0
D = 0
MC = 0
FOR M = 0 TO 384
M1 = 147 + M
IF M = T THEN
' Draw vertical line
COLOR CL0
LINE (M1, 128)-(M1, 375)
MC = MC + 1
T = T + ML(MC)
MS = 0
ELSE
' Plot point(s)
COLOR CL1
PSET (M1, 247 - 6.4 * Equt(D)) ' Note Equt used
IF MS = 0 OR MS = 10 OR MS = 20 THEN
' Plot circle representing published value
COLOR CL2
READ E ' published values
E = FIX(E) + (E - FIX(E)) * 5 / 3
CIRCLE (M1, 247 - 6.4 * E), 2
END IF
MS = MS + 1
D = D + 1
END IF
IF ML(MC) = 33 AND M = T - 18 THEN M = M + 1
NEXT
' Tidy up
LOCATE 26, 15
COLOR CL1
PRINT "Graph shows results of calculation."
COLOR CL2
PRINT TAB(15); "Circles show published values of Equation of Time."
COLOR CL0
END
' Note: Comparing the calculated values with the 36 published ones
' shows a Root Mean Square difference of about 3.7 *seconds*.
' The greatest difference is 6.0 seconds, on July 11.
FUNCTION Equt (D)
' Equation of Time, in minutes, on Dth day of year.
' (D = 0 on January 1.)
PI = 3.14159265#: W = PI / 182.5: V = W * (D + 10)
X = (ATN(TAN(V + .0334 * SIN(V - 12 * W)) / .9174) - V) / PI
Equt = (X - INT(X + .5)) * 720
END FUNCTION
------------------------------------------------
I do know how it works. In fact, I coded it from first principles. I
wrote a magazine article about it, which I'd have to send you to
explain it. Let me know if you really want it.
The constants in Equt are as follows: 182.5 is the number of days in
half a year. 10 is the number of days from the December solstice to
January 1. 0.0334 is twice the eccentricity of Earth's orbit around the
Sun. 12 is the number of days from the solstice to perihelion. 0.9174
is the cosine of the angle of tilt of the Earth's axis. 720 is the
number of minutes in half a day.
Enjoy (or ignore)!
dow
--- Platinum Xpress/Win/WINServer v3.0pr5
* Origin: The Bayman BBS,Toronto, (416)698-6573 - 1:250/514 (1:250/514)SEEN-BY: 633/267 270 @PATH: 250/514 123/500 379/1 633/267 |
|
| SOURCE: echomail via fidonet.ozzmosis.com | |
Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.