#!/usr/bin/perl
#
# We are on a plane flying due west, as they often do near the
# Aleutian Islands, on their way to the Orient. We are curious, at
# what latitude do they need to fly, to "turn back the hands of time",
# or at least freeze them, not allowing the sun to set?
#
# Author: Dan Jacobson https://www.jidanni.org/
# Copyright: https://www.gnu.org/licenses/gpl.html
# Created: 2023-03-22T18:42:16+0000
# Last-Updated: 2023-03-23T07:08:37+0000
#     Update #: 58
use strict;
use warnings q(all);
use Math::Trig;
my $s     = 5;
my %units = ( kmh => 1, mph => 1.609344, kts => 1.852 );
printf "%*s", $s, $_ for "lat", sort keys %units;
print "\n";
for my $latitude ( 0, 15, 30, 45, 50, 55, 60, 65, 70, 80, 90 ) {
    printf "%*.0f", $s, $latitude;
    my $res = 2 * pi * 6378 / 24 * cos deg2rad $latitude;
    printf "%*.0f", $s, $res / $units{$_} for sort keys %units;
    print "\n";
}

# Yes, surely others have made better programs to compute the same thing.
# OK, I see my result is very close to
# https://www.vcalc.com/wiki/MichaelBartmess/Rotational+Speed+at+Latitude
