Thursday, August 9, 2018

HP Prime and TI-84 Plus CE: Mercator Sailing Course and Distance

HP Prime and TI-84 Plus CE: Mercator Sailing Course and Distance

Introduction

The following program MERCATOR calculates the course direction and distance in miles given two pairs of latitude (north/south) and longitude (east/west).  Conversion to arc minutes will be required during calculation.

Formulas Used:

Course:

C = atan ( | λ2 – λ1 | * 60 / | M2 – M1 | )
Where:
M1 = 7915.7045 * log ( tan (45° + L1 / 2 ) ) – 23.2689 * sin L1
M2 = 7915.7045 * log ( tan (45° + L2 / 2 ) ) – 23.2689 * sin L2

Direction:


D = | L2 – L1 | * 60 / cos C

HP Prime MERCATOR

EXPORT MERCATOR()
BEGIN
// EWS 2018-08-10
// The Calculator Afloat

HAngle:=1; // degrees
LOCAL L1,L2,λ1,λ2,M1,M2;
LOCAL C,D;

INPUT({L1,λ1,L2,λ2},"Mercator",
{"L1:","λ1:","L2:","λ2:"},
{"Latitude 1",
"Longitude 1",
"Latitude 2",
"Longitude 2"});

M1:=7915.7045*LOG(TAN(45+L1/2))
-23.2689*SIN(L1);
M2:=7915.7045*LOG(TAN(45+L2/2))
-23.2689*SIN(L2);

LOCAL M;
C:=ABS(λ1-λ2)*60;
M:=ABS(M2-M1);
C:=ATAN(C/M);

D:=ABS(L2-L1)*60/COS(C);

RETURN {C,D};

END;

TI-84 Plus CE Program MERCATOR

Degree
Input "LATITUDE 1:",A
Input "LONGITUDE 1:",B
Input "LATITUDE 2:",C
Input "LONGITUDE 2:",D
7915.7045*log(tan(45+A/2))-23.2689*sin(A)→E
7915.7045*log(tan(45+C/2))-23.2689*sin(C)→F
abs(D-B)*60→R
abs(F-E)→M
tan^-1(R/M)→R
abs(C-A)*60/cos(R)→S
Disp "COURSE:",R,"DISTANCE:",S

Example

Latitude 1:  102° 54’ 16” W = 102.9044444444°
Longitude 1: 43° 21’ 16” N = 43.3544444444°
Latitude 2:  106° 3’ 8” W = 106.0522222222°
Longitude 2: 42° 4’ 30” N = 42.075°

Results:

Course:  5.782390957°

Distance:  189.832588 mi

Source: 

Henry H. Shufeldt and Kenneth E. Newcomer  The Calculator Afloat: A Mariner’s Guide to the Electronic Calculator Naval Institute Press:  Annapolis, Maryland.  1980


I will be taking a few weeks off this August, it will be part vacation, part math research.  I plan to come back during the week of 8/20/2018.  I may have one more post before the break, especially if a calculator I ordered comes in time for a review.  Anyway, stay safe, sane, and for those of you in the Northern Hemisphere, cool.  Weather wise, this summer has been bonkers.

Eddie

All original content copyright, © 2011-2018.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.  Please contact the author if you have questions.

No comments:

Post a Comment

DM 41L and HP 41C: Schur-Cohn Algorithm

DM 41L and HP 41C:  Schur-Cohn Algorithm Introduction The Schur-Cohn Algorithm tests whether the roots of a polynomial p(x) lies with i...