Horizontal sundial calculations: Difference between revisions
Content deleted Content added
Line 1,354: | Line 1,354: | ||
=={{header|Microsoft Small Basic}}== |
=={{header|Microsoft Small Basic}}== |
||
{{trans|ALGOL-68}} |
|||
<lang microsoftsmallbasic> |
|||
TextWindow.Write("Enter latitude => ") |
|||
lat = TextWindow.ReadNumber() |
|||
TextWindow.Write("Enter longitude => ") |
|||
lng = TextWindow.ReadNumber() |
|||
TextWindow.Write("Enter legal meridian => ") |
|||
ref = TextWindow.ReadNumber() |
|||
sLat = Math.Sin(Math.GetRadians(lat)) |
|||
TextWindow.WriteLine("") |
|||
TextWindow.Write(" sine of latitude: ") |
|||
TextWindow.WriteLine(Math.Round(sLat * 10000) / 10000) |
|||
TextWindow.Write(" diff longitude: ") |
|||
TextWindow.WriteLine(lng - ref) |
|||
TextWindow.WriteLine("") |
|||
TextWindow.WriteLine("Hour, sun hour angle, dial hour line angle from 6am to 6pm") |
|||
For hour = -6 To 6 |
|||
hourAngle = 15 * hour |
|||
hourAngle = hourAngle - (lng - ref) ' correct for longitude difference |
|||
hourLineAngle = math.GetDegrees(Math.ArcTan(sLat * Math.Tan(Math.GetRadians(hourAngle)))) |
|||
TextWindow.Write("HR=") |
|||
TextWindow.CursorLeft = 3 + (3 - Text.GetLength(hour)) |
|||
TextWindow.Write(hour) |
|||
TextWindow.Write("; HRA=") |
|||
TextWindow.CursorLeft = 12 + (6 - Text.GetLength(hourAngle)) |
|||
TextWindow.Write(hourAngle) |
|||
TextWindow.Write("; HLA=") |
|||
TextWindow.CursorLeft = 24 + (4 - Text.GetLength(Math.Floor(hourLineAngle))) |
|||
TextWindow.Write(Math.Round(hourLineAngle * 1000) / 1000) |
|||
TextWindow.WriteLine("") |
|||
EndFor |
|||
</lang> |
|||
{{out}} |
|||
Enter latitude => -4.95 |
|||
Enter longitude => -150.5 |
|||
Enter legal meridian => -150 |
|||
sine of latitude: -0.0863 |
|||
diff longitude: -0.5 |
|||
Hour, sun hour angle, dial hour line angle from 6am to 6pm |
|||
HR= -6; HRA= -89.5; HLA= 84.225 |
|||
HR= -5; HRA= -74.5; HLA= 17.283 |
|||
HR= -4; HRA= -59.5; HLA= 8.334 |
|||
HR= -3; HRA= -44.5; HLA= 4.847 |
|||
HR= -2; HRA= -29.5; HLA= 2.795 |
|||
HR= -1; HRA= -14.5; HLA= 1.278 |
|||
HR= 0; HRA= 0.5; HLA= -0.043 |
|||
HR= 1; HRA= 15.5; HLA= -1.371 |
|||
HR= 2; HRA= 30.5; HLA= -2.91 |
|||
HR= 3; HRA= 45.5; HLA= -5.018 |
|||
HR= 4; HRA= 60.5; HLA= -8.671 |
|||
HR= 5; HRA= 75.5; HLA= -18.451 |
|||
HR= 6; HRA= 90.5; HLA= 84.225 |
|||
=={{header|МК-61/52}}== |
=={{header|МК-61/52}}== |