Anonymous user
Horizontal sundial calculations: Difference between revisions
→{{header|Liberty BASIC}}: Code formatting; output
(Add Factor example) |
(→{{header|Liberty BASIC}}: Code formatting; output) |
||
Line 1,409:
Based on Algol & BBC BASIC versions. Note Liberty BASIC works in radians.
<lang lb>global pi
pi = 3.14159265
input "Enter latitude (degrees) : "; latitude ' -4.95
input "Enter longitude (degrees) : "; longitude ' -150.5
input "Enter legal meridian (degrees): "; 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(
if abs(
print using( "##.##", hour), using("####.### ", hra), using("####.###", hla)
next hour
end
function rad2deg(
rad2deg = theta * 180 / pi
end function
function deg2rad(
deg2rad = theta * pi / 180
end function
function sgn(
if x > 0 then sgn = 1 else sgn = -1
end function</lang>
{{out}}
<pre>
Enter latitude (degrees) : -4.95
Enter longitude (degrees) : -150.5
Enter legal meridian (degrees): -150.0
Time Sun hour angle Dial hour line angle
6.00 -89.500 84.225
7.00 -74.500 17.283
8.00 -59.500 8.334
9.00 -44.500 4.847
10.00 -29.500 2.795
11.00 -14.500 1.278
12.00 0.500 -0.043
13.00 15.500 -1.371
14.00 30.500 -2.910
15.00 45.500 -5.018
16.00 60.500 -8.671
17.00 75.500 -18.451
18.00 90.500 -95.775
</pre>
=={{header|LiveCode}}==
|