Jump to content

Horizontal sundial calculations: Difference between revisions

m (→‎{{header|Go}}: library change, also added output)
Line 1,341:
HR = 6; HRA = 90.500; HLA = 84.225
</pre>
 
=={{header|Run BASIC}}==
<lang runbasic>global pi
pi = 22 / 7
print "Enter latitude (degrees) : "; :input latitude ' -4.95
print "Enter longitude (degrees) : "; :input longitude ' -150.5
print "Enter legal meridian (degrees): "; :input meridian ' -150.0
 
print
print "Time Sun hour angle Dial hour line angle"
for hour = 6 TO 18
hra = (15 * hour) - longitude + meridian -180
hla =rad2deg( atn( sin( deg2rad( latitude)) *tan( deg2rad( hra))))
if abs( hra) >90 then hla =hla +180 *sgn( hra *latitude)
print using( "##", hour);" ";using("####.##", hra);" ";using("####.###", hla)
next hour
function rad2deg( theta)
rad2deg =theta *180 /pi
end function
function deg2rad( theta)
deg2rad =theta *pi /180
end function
function sgn( x)
if x >0 then sgn =1 else sgn =-1
end function
end</lang>
<pre>
Enter latitude: -4.95
Enter longitude: -150.5
Enter legal meridian: -150
 
Time Sun hour angle Dial hour line angle
6 -89.50 84.606
7 -74.50 17.316
8 -59.50 8.342
9 -44.50 4.850
10 -29.50 2.796
11 -14.50 1.279
12 0.50 -0.043
13 15.50 -1.371
14 30.50 -2.911
15 45.50 -5.021
16 60.50 -8.680
17 75.50 -18.488
18 90.50 -96.224</pre>
 
=={{header|Sather}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.