Showing posts with label navigation. Show all posts
Showing posts with label navigation. Show all posts

Sunday, November 26, 2023

DM42/HP 42S: Most Probable Position

DM42/HP 42S:  Most Probable Position



Introduction


The program MPP calculates an adjusted latitude (+N, -S) and adjusted longitude (+W, -E) of an observer:  


*  The latitude and longitude of the observer's dead reckoning.  

*  The computed altitude and azimuth (N = 0°, E = 90°, S = 180°, W = 270°).

*  The height of the sextant held by the observer.  


The most probable position is calculated by:


Calculated latitude:


LAT* = L - (Hc - H0) × cos(Z)


Calculated longitude:  


LON* = λ - ( (H0 - Hc) × sin(Z) ÷ cos(L) )


where


L =  dead reckoning latitude 

λ =  dead reckoning longitude

Hc = computed altitude of the celestial object

Z = zenith of the celestial object

H0 = correct sextant height


L, λ, Hc, H0 are customarily entered in degrees-minutes or degrees-minutes-seconds format.   The program MPP requires the four variables to be entered in L, λ, Hc, and H0 to be entered in DDMM.m format (see the Instructions section).  



Instructions


Soft menu items are enclosed in parenthesis.


1.  Enter the longitude and latitude in DDMM.m format.   DD represents decimal degrees, MM represents the integer part of minutes, and .m represents the fractional part of minutes.  


Examples:


Enter 52°00'  as 5200.


Enter 17°16.56' as  1716.56.


Enter the longitude, press [ENTER], enter the latitude, then press (LA/LO).   North longitude is positive, west latitude is positive.


2.  Enter the altitude of the reference object (star, planet, sun, other celestial object) in DDMM.m format, press [ENTER], the object's zenith in degrees, then press (HC/Z).  


3.  Enter the correct sextant height in DDMM.m format, press (>H0).  The altitude intercept (Hc - H0) is displayed in miles.  (negative is towards, positive is away)


4.  Press (CALC) to get the computed latitude (LAT*), press [ R/S ] to get the computed longitude (LNG*).  


To exit the program, press (EXIT).  



DM42/HP 42S/Free42/Plus Code:  Most Probable Position


00 { 234-Byte Prgm }

01▸LBL "MPP"

02 DEG

03 "MOST PROBABLE"

04 AVIEW

05 PSE

06 "POSITION, HP 65"

07 AVIEW

08 PSE

09 "DDMM.m, +N, +W"

10 AVIEW

11 PSE

12▸LBL 30

13 "LA/LO"

14 KEY 1 XEQ 21

15 "HC/Z"

16 KEY 2 XEQ 22

17 ">H0"

18 KEY 3 XEQ 23

19 "CALC"

20 KEY 4 XEQ 24

21 "EXIT"

22 KEY 6 XEQ 26

23 MENU

24▸LBL 00

25 STOP

26 GTO 00

27▸LBL 21

28 XEQ 31

29 STO 07

30 X<>Y

31 XEQ 31

32 STO 02

33 GTO 30

34▸LBL 22

35 STO 05

36 X<>Y

37 XEQ 31

38 STO 04

39 GTO 30

40▸LBL 23

41 XEQ 31

42 STO 06

43 RCL 04

44 X<>Y

45 -

46 STO 01

47 XEQ 32

48 GTO 30

49▸LBL 31

50 →HMS

51 100

52 ÷

53 →HR

54 RTN

55▸LBL 32

56 →HMS

57 100

58 ×

59 →HR

60 RTN

61▸LBL 24

62 RCL 02

63 RCL 05

64 COS

65 RCL× 01

66 -

67 STO 03

68 XEQ 32

69 "LAT*="

70 ARCL ST X

71 AVIEW

72 STOP

73 RCL 07

74 RCL 05

75 SIN

76 RCL× 01

77 RCL 02

78 COS

79 ÷

80 +

81 1

82 →REC

83 →POL

84 X<>Y

85 STO 08

86 XEQ 32

87 "LNG*="

88 ARCL ST X

89 AVIEW

90 PSE

91 GTO 30

92▸LBL 26

93 CLMENU

94 EXITALL

95 .END.



Download mpp.raw:  

https://drive.google.com/file/d/1Jrs14guVv3wuYEMuFRYDq4N3MGHrICxL/view?usp=sharing 



Example


Data Given:

Latitude:  30°44' N

Longitude:  128°36' W

Computed Altitude of star:  21°40'

Azimuth of the star:  61°

Corrected Sextant:  19°32'


Enter:

3044 ENTER 12836 (LA/LO)

2140 ENTER 61 (HC/Z)

1932 (>H0)   


(CALC)  

LAT*=2941.57  (29°41.57' N)

LNG*=13046.25  (130°46.25' W)



Source


Hewlett Packard.  "NAV 1-20A:  MOST PROBABLE POSITION"  HP-65 Navigation Pac 1 1974.  pp. 64-65, 137




Eddie


All original content copyright, © 2011-2023.  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. 


Saturday, November 11, 2023

HP 42S/DM42 Programs in the Style of HP 65/67 Cards

HP 42S/DM42 Programs in the Style of HP 65/67 Cards


Programming Cards


In the 1970s, a programmable scientific calculators stored programs on magnetic cards.   The magnetic cards were then loaded on to calculator.   Two such calculators that used magnetic cards are the legendary HP 65 and HP 67, both from Hewlett Packard.    


The aim of these programs is to simulate classic programs from the HP 65 and HP 67 as they are stored on the cards, with prompts and messages to enhance the user experience.

The HP 65 had five user-definable keys A-E, while the HP 67 adds five additional user-defined labels a-e through a shift-key combination.

The MENU command on the HP 42S* creates a user key menu within a program, up to six keys.   I use this command to simulate running programs from loading cards.

(*and Free42, Plus42, Swiss Micros DM42)

The file included in the link below include four programs that are ported from various application books (pacs) of the HP 65 and HP 67.   


Demonstration Program:  demo.raw


When the program is run, a card is "simulated".   


I usually have the card in this format:

Left keys:  inputs, will sometimes give outputs

Key 4 (or 5): labeled CALC, get outputs

Key 6:  EXIT.  Exits the program.  Simulates removing the card.  


Demonstration


Key 1:  enter X coordinate

Key 2:  enter Y coordinate

Key 4:  calculate the norm

Key 6:  exit the program



Notes:  before GTO 30,  I have a pause command (PSE) so the menu returns.  

If I have multiple outputs, I have a stop command (STOP).  


Message convention: 

Prompts with a colon:  (:)  input

Prompts with an equals sign:  (=)  output


#  comments


00 { 134-Byte Prgm }

01▸LBL "DEMO"

02 "VECT NORM/ANG"         #  short description of the program

03 AVIEW

04 PSE                                        #  pauses the screen (allows for print)

05 "BY EWS"

06 AVIEW

07 PSE

08▸LBL 30                           # label 30 starts the menu

09 "→X"

10 KEY 1 XEQ 21

11 "→Y"

12 KEY 2 XEQ 22

13 "CALC"

14 KEY 4 XEQ 24

15 "EXIT"

16 KEY 6 XEQ 26

17 MENU                       # menu setup

18▸LBL 00

19 STOP

20 GTO 00                     # repeats the menu unless a menu key is pressed

21▸LBL 21                   # enter X

22 STO 01

23 "X:"

24 ARCL ST X   

25 AVIEW

26 PSE

27 GTO 30

28▸LBL 22                # enter Y

29 STO 02

30 "Y:"

31 ARCL ST X

32 AVIEW

33 PSE

34 GTO 30

35▸LBL 24            # calculate

36 RCL 02

37 RCL 01

38 →POL

39 "NORM="

40 ARCL ST X

41 AVIEW

42 STOP

43 "ANGLE="

44 ARCL ST Y

45 AVIEW

46 PSE

47 GTO 30

48▸LBL 26       # exit routine

49 CLMENU

50 EXITALL

51 .END.


Sample Output:


VECT NORM/ANG

BY EWS

X:5.7500

Y:6.8500

NORM=8.9434

ANGLE=49.9894


Program Space vs. Information Labels


When messages and alpha strings are added, along with the necessary AVIEW, PSE, and STOP commands, the program space requirements increase.   I put these messages to make the program as user friendly as possible.  



What's Included in the Zip Drive


Five programs:


Demonstration Program:  demo.raw

Sight Reduction Table:  str.raw

Physiologic Shunt and Fick:  phsy.raw

1-D Normal Shocks for Ideal Gases:  shock.raw

P and S Seismic Wave Velocity:  seismic.raw


PDF file of instructions and program listing



Download here (zip file):  

https://drive.google.com/file/d/1_0F_DHCGxcLbmCtrhMQbKShjrpBUgB7i/view?usp=share_link


Enjoy and please let me know, I plan to create another volume of these style of programs.  



Note:  The next blog entry will be on November 18, 2023


Eddie 


All original content copyright, © 2011-2023.  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. 


Sunday, June 5, 2022

TI-84 Plus CE Python: Polygon Path (ppath.py)

TI-84 Plus CE Python:  Polygon Path (ppath.py)


Introduction


The program PPATH:


Between two points:  


1.  Calculates the required leftward, counter-clockwise angle.


2.  Calculates the distance to be traveled. 


The path starts at the origin (0,0).  You can create open paths or closed polygons.  For polygons, add another point and include (0,0) as the last point.  


TI-84 Plus CE Python Program:  PPATH - Python (ppath)


Download the TI-84 Plus CE Python file here:  https://drive.google.com/file/d/1QnPP9ikx45i7gAH22fTkFAmE-pBFQwTD/view?usp=sharing


Copy the code for a text file.  


print("Poly Path \nEdward Shore")

# 2022-04-27

from math import *

from turtle import *

t=Turtle()

# t is required for turtle

from ti_system import *


# hide the grid

t.hidegrid()


# obtain the points

x=[0]

y=[0]

# angles

g=[0]

# degree difference

q=[0]

# distance

d=[0]


print("Point 0: (0,0)")

print("#_0 to #_n-1")

n=eval(input("# points? "))


for i in range(1,n):  

  a=eval(input("x"+str(i)+"? "))

  b=eval(input("y"+str(i)+"? "))

  x.append(a)

  y.append(b)

  r=sqrt((a-x[i-1])**2+(b-y[i-1])**2)

  d.append(r)

  m=degrees(atan2(b-y[i-1],a-x[i-1]))

  v=m-g[i-1]

  if v<0:

    v+=360

  g.append(m)

  q.append(v)

  r6=round(r,6)

  m6=round(v,6)

  print("Distance: "+str(r6))

  print("Left Turn: "+str(m6)+"\u00b0")


print("\nPress [clear] to continue.")

disp_wait()


t.home()

t.pencolor(0,128,0)

# set speed

t.speed(4)

for i in range:

  t.left(q[i])

  t.forward(d[i])

t.done()


Notes:


1.  Turtle is a add-in module for the TI-84 Plus CE Python, which must be downloaded. Download the Turtle module here:  https://education.ti.com/en/product-resources/turtle-module/ti84ce-python


2.  Calling the Turtle module automatically assigns the variable t to a drawing turtle by the line t=Turtle().


3.  The ti_system module is exclusive to the TI-84 Plus CE.  This allows the program to pause with the disp_wait command.  


4.  The underscore character ( _ ) can be typed by the [ 2nd ] [ (-) ] (ans) sequence.  


5.  The hashtag character ( # ) can be typed by the [ 2nd ] [ 3 ] (L3) sequence.  


6.  The line for i in range(1,n) starts a for loop with i taking the values from 1 to n-1. This is good for lists when the initial point (point 0) does not need further processing. 


7.  The default operating angle measurement in Python is Radians.  


8.  The angle difference, which tells us how many degrees to turn left, is normalized to the 0°-360° range.   This is optional.   


9.  The line t.home() sets the turtle to point (0,0) and sets the turtle's orientation to 0° (facing right, forward on the x-axis).


10.  The line t.done() shows the results of the turtle commands. 


Examples


Example 1: Quadrilateral




Example 2:  An Open Path




Enjoy!  


Eddie 



All original content copyright, © 2011-2022.  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. 


Monday, April 11, 2022

Retro Review: Calculated Industries NautiCalc Plus

 Retro Review:   Calculated Industries NautiCalc Plus









Quick Facts:


Model:  NautiCalc Plus

Company:  Calculated Industries

Years:  1996-1998

Type:  Nautical

Batteries: 1 x CR-2032

Operating Mode:  Chain

Memory Registers: 10


Features


For a company that produces specialized calculators, the NautiCalc Plus is a rare calculator.   I purchased mine from Calculator Source's eBay page.   Calculations that the NautiCalc offers are:


*  conversions of time

*  conversions of distance

*  conversions of speed

*  triangulation calculations:  course direction, 1st bearing, 2nd bearing, distance of the bearing object, distance abeam

*  solver:  speed, distance, time

*  solver:  tank capacity in gallons, fuel efficiency (statute miles per gallon), range (how far can you travel with a fuel tank)

*  paperless tape with the capacity of 10 entries, accessed by the [ Rcl ] [ = ], which is not marked on the calculator.   Scroll the entries by the plus and minus keys.  


Memory Registers


The NautiCalc has ten memory registers, M0 through M9.   What is unusual is that the [ Stor ] key acts a memory-plus for M0.   For example:


[ Conv ] [ + ] (Clr Mem)

25 [ Stor ] 0  (M-0   25)

[ Stor ] 1    (M-1  25)

50 [ Stor ] 0  (M-0  50)

[ Stor ] 1  (M-1 50)


[ Rcl ] 0   (M-0 75)   75 is stored in M0,  50 and 25 were added together

[ Rcl ] 1   (M-1 50)   50 is stored in M1, 50 replaced 25 in M1


Miles


There are two measurements for miles:  statute miles and nautical miles.   Statue miles, also known as survey miles, are miles related to road distance, equal to 5,280 feet.   Nautical miles, which are used in sailing and air travel, are measure from 1% of 1 degree of the Earth's curvature (see source, "What Are Statute Miles?").   


Statue Miles:  [ Conv ] [ 7 ]


Nautical Miles:  [ Miles ]


1 nautical mile ≈1.1507794 statute mile


Entering Time 


Time can be entered with several ways:


*  [ AM ] and [ PM ] keys.  We can use the shortcut method hhmmss or hhmm format to enter time.

*  The colon [ : ] key.   

*  The use hours, minutes, and second keys ([ Hr ], [ Min ], [ Sec ]).  


The [ Conv ] [ : ] changes the time format between 12-hour and 24-hour military time format.  


If we want to enter degrees-minutes-seconds, we must use the [ d:m:s ] key.  


Stopwatch 


The stopwatch can be started and stopped with the [ Timer ] key twice.  The stopwatch also has a split/lap feature with the [ S/Lap ].  While the stopwatch is running, a clock icon is on the display.


Timer


The timer is started with pressing the [ Timer ] key, entering the time, then pressing the [ Timer ] key again.   The NautiCalc Plus has a buzzer, not very loud, that can be turned on and off.  While the timer is going, we see a clock and star on the display.  The entire display flashes when the timer is completed. 


Not many calculators as a whole have the stopwatch and timer, so to have it is a nice feature.  


Now let's demonstrate some of the main calculations that are done wiht the NautiCalc Plus.  


Example:  Fuel Efficiency


If a tank can carry 15 gallons and has an average efficiency of 30 miles per gallon, what is the range?


[ On/C ] [ On/C ]

15 [ Conv ] [ Speed ] (Cap) (display has GAL)

30 [ Conv ] [ Time ] (Eff)   (display has MPG)

[ Conv ] [ Dist ] (Range)

Result:  RNG:  450 MI S  (450 statute miles)


Example:  Distance of Objects and Abeam


Traveling with 30° course with bearings reading 45°12' and 58°42', respectively.   You have traveled 5 nautical miles.   Find the distance bearing from the bearing object and distance abeam.  


[ On/C ] [ On/C ]

30 [ Course° ]   (CRSE)

45 [ d:m:s ] 12 [ 1stϕ ]  (BRG1)

58 [ d:m:s ] 42 [ 2ndϕ ] (BRG2)

5 [ Miles ] [ Dist ] (DIST   5  N MI)

[ Dist ]    (Display:   TRVL 5  N MI)

[ Dist ]    (Display:  DOBJ 5.6156432 N MI)

[ Dist ]    (Display:  BEAM 3.1139547 N MI)


TRVL:  distance traveled

DOBJ:  distance from object

BEAM:  distance abeam


Example:  Speed/Time/Distance 


If a boat travels 13.5 nautical miles and it took 2 hours 23 minutes, what is the speed of the boat?


[ On/C ] [ On/C ]

13.5 [ Miles ] [ Dist ]

2 [ Hr ] 23 [ Min ] [ Time ]

[ Speed ] 

Display:  SPD 5.6643357 K NO T  (5.6643357 knots, 6.5184011 miles an hour)



Closing Thoughts


The keyboard is solid with the keys have a nice feel to them.  The NautiCalc Plus comes with a protective wallet, where the user guide can fit in the pockets.   


I really like this calculator and how Calculated Industries makes calculators for specific applications.  I would have loved to have seen the NautiCalc had a longer life than it did.   It's really cool to collect.  


I'm now retired from purchasing vintage calculators online.  I still will be posting retro reviews in the next few months, including the recently purchased the Texas Instruments TI-57 LCD (1982) and HP 45 (1973).  I am also going to include calculators that have been sitting in the garage that I didn't get a chance to do a review on, such as the Radio Shack EC-4026 (Casio fx-4500P equivalent) and TI-65.  

Source:


Bollman, Mark.  "NautiCalc Plus" April 21, 2013.   Last Accessed March 24, 2022.  http://mathcs.albion.edu/~mbollman/CI/NCalc+.htm  


Jones, Louise.  "What Are Statute Miles?"   Sciencing.  April 25, 2017.  Last Accessed March 27, 2022.  https://sciencing.com/statute-miles-8358166.html  



Until next time,


Eddie


All original content copyright, © 2011-2022.  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. 


Sunday, March 28, 2021

Fun With the Casio fx-3650P (March 28 Edition)

Fun With the Casio fx-3650P (March 28 Edition)



Square Root Simplification



This program attempts to simplify the square root √D  to M√A, where D, M, and A are positive integers.



Program:  (68 bytes)

? → D : 2 →  M : Lbl 0 : D ÷ M ² → A : Fix 0 : Rnd : Ans →B : Norm 1 : A - B = 0 ⇒ Goto 1 : 1 M+  : M √ D ⇒ Goto 2 : Goto 0 : Lbl 2 : 1 → M : D →B : Lbl 1 : M ◢ B



Example:

D = 188.  Result:  M = 2, B = 47.   √188 = 2√47

D = 775.  Result:  M = 5, B = 31.   √775 = 5√31



Present Value of a Growing Annuity



Calculate the present value of an annuity where the payments grow X% of each period, where the Y% is the interest rate of the annuity.  


Variables:

A = PV

X = periodic growth rate, G%

Y = periodic interest rate, R%

B = payment

C = number of periods, N



Programs:  (77 steps)

? → B : ? → X : ? → Y : ? → C : 0 → A : 1 → M : Lbl 0 : A + ( 1 + .01 X ) ^ ( M - 1 ) ÷ ( 1 + .01 Y ) ^ M → A : 1 M+ : M > C ⇒ Goto 1 : Goto 0 : Lbl 1 : A B → A


Examples:



1.  B = 1000.00 (PMT), X = 3 (G%), Y = 5  (R%), C = 10

Result:  A = 8747.596154 ($8,747.60)



2.  B = 1000.00, X = 8, Y = 5, C = 10

Result:  A = 10846.42231  ($10,846.42)



Smoke:  Front Velocity and Time for a Corridor to Fill


This program estimates:

*  The front velocity of the smoke (how quickly the smoke fills a corridor)

*  The time it takes for smoke to fill the corridor.



The program uses SI units (meters, seconds, kilograms).  



Program:  (44 bytes)

? → A : ? → B : ? → Y : ? → X : √ ( 9.80665 Y ( 1 - A ÷ B ) ) ÷ 2 → C  ◢ X ÷ C → D


Variables:


Inputs:

A: Ambient Temperature, °C

B:  Gas Temperature, °C

Y:  Height, m

X:  Length, m


Outputs:

C:  Velocity, m/s

D:  Time, s



Example:

Inputs:

A: Ambient Temperature = 28°C

B:  Gas Temperature = 38°C

Y:  Height = 2.95 m

X:  Length = 4.18 m



Results:

C:  Velocity = 1.379588456 m/s

D:  Time = 3.029889081 s



Source:

Lawson, J.R. and Quintiere, J.G. "Slide Rule Estimates of Fire Growth".  Fire Technology, Vol 21., No. 4, November 1985, pg. 267



Sailing:  Distance by Bearings


This program calculates the distance off the abeam for either one or two bearings on the bow.  The variable C is the choice variable.  For one bearing, enter 1 for C.  For two bearings, enter 2 for C.  The fx-3650P is set to Degrees mode. 



Distance Using One Bearing

D = X * sin A / cos A = X * tan A

A = angle off the bow, X = run,  D = distance off the abeam



Distance Using Two Bearings

D = (X * sin A) / (sin abs(A - B))

A = first angle, B = second angle



Program: (60 bytes)

Deg : ? → C : ? → X : ? → A : C = 2 ⇒ Goto 2 : X tan A → D : Goto 3 : Lbl 2 : ? → B : √ ( ( A - B ) ² ) : X sin A ÷ sin Ans → D : Lbl 3 : D


 Example:


1 Angle:   X = 150 ft, A = 15°.   Enter 1 for C.   Result:  D = 40.192378886 ft



2 Angles:  X = 150 ft, A (first) = 15°, B (second) = 19°.  Enter 2 for C.  Result:  D = 556.5484418 ft


Source:

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



Eddie 


All original content copyright, © 2011-2021.  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.


Monday, February 8, 2021

An Alternative Way of Finding the Angle in a Rectangular to Polar Conversion

An Alternative Way of Finding the Angle in a Rectangular to Polar Conversion


Welcome to a special Monday edition of Eddie’s Math and Calculator Blog. 


The Traditional Method


Often we are required to find polar coordinates of a given point (x,y).   Finding the radius, r, is fairly simple:


r = √(x^2 + y^2) 


When talking about complex numbers, r represents the absolute value of x + yi where i = √-1.


Finding the angle, θ, often uses the formula:


θ = atan(y/x)


In complex numbers, θ represents the argument (arg) function.


On a scientific calculator the range of the arctangent function is ( -90°, 90° ).  (open interval).   In finding the true angle, adjustments will be required:





Let a = atan(y/x). Then: 


Quadrant I (x and y are both positive):  θ = a

Quadrant II (x is negative, y is positive): θ = a + 180°

Quadrant III (x and y are both negative):  θ = a - 180°

Quadrant IV (x is positive, y is negative):  θ = a 


If you are working with radian angle measures, know that 90° = π/2, and 180° = π.


This does not take into consideration situations where either x or y is 0:


If x > 0 and y = 0:  θ = 0°

If x = 0 and y > 0:  θ = 90°

If x < 0 and y = 0:  θ = 180°

If x = 0 and y < 0:  θ = -90°


Is there a shorter way to calculate θ?  


The Vector Method


Consider the point (x, y) as a vector [x, y].   Now draw another vector [x, 0].  In a regular Cartesian coordinate system, angles are measured from the x-axis counter clockwise.  





Let a and b represent two vectors.  Then the angle between two vectors are:


cos θ = (a ● b) / ( ||a|| ||b|| ) = dot(a,b) / ( norm(a) * norm(b) )


with:

dot(a,b) = a1 * b1 + a2 * b2

norm(a) = √(a1^2 + a2^2)

norm(b) = √(b1^2 + b2^2)


Let a = [x, y] and b = [x, 0].  Then:


cos θ = (x^2) / (√(x^2 + y^2) * √(x^2))

cos θ = (x^2) / (√(x^2 + y^2) * x)

cos θ = x / √(x^2 + y^2)

θ = acos( x / √(x^2 + y^2) )


The range of the arccosine function of a calculator is [ 0°, 180° ].  


If y < 0, the angle would be measured clockwise, and therefore I would make the adjustment:

θ = -acos( x / √(x^2 + y^2) )


In summary:

If y ≥ 0, θ = acos( x / √(x^2 + y^2) )

If y < 0, then θ = -acos( x / √(x^2 + y^2) )


Examples:


Find the angle, in degrees, in a rectangular to polar conversions:


Quadrant I  (2, 4):  y ≥ 0:   θ = acos( 2 / √(2^2 + 4^2) ) ≈ 63.43494882°


Quadrant II (-2, 4):  y ≥ 0:    θ = acos( -2 / √((-2)^2 + 4^2) ) ≈ 116.5650512°


Quadrant II (-2, -4):  y < 0:  θ = -acos( (-2) / √((-2)^2 + (-4)^2) ) ≈ -116.5650512°


Quadrant IV (2, -4):  y < 0:  θ = -acos( 2) / √(2^2 + (-4)^2) ) ≈ -63.43494882°


Vector Method for Navigation


In navigation, angles start from true North (up) and rotate clockwise towards East (right).  Angles are measured from 0° to 360°.


Use the vectors [0, N] and [E, N], then the angle between these vectors are:

If E ≥ 0,  θ = acos( N / √(E^2 + N^2))

If E < 0, θ = 360° - acos( N / √(E^2 + N^2))


Note:  This is the first blog entry that I have typed on Google Docs.  I have been using Windows app Wordpad for the last three years.   I am testing Google apps as I am considering buying a Chromebook.


Eddie


All original content copyright, © 2011-2021.  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.


Sunday, January 31, 2021

HP 42S/DM42 and TI-85: True Bearing vs. Compass Bearing

 HP 42S/DM42 and TI-85:  True Bearing vs. Compass Bearing


Introduction 





The program converts angles between true bearing and compass bearing.


True Bearing:  0° to 360°, going clockwise from due north.  North is typically represented as the positive y direction.  True bearing is also known as azimuth.


Compass Bearing:  The grid is divided into four quadrants, each given one direction.  Measurements from each quadrant range from 0° to 90°.


Northeast (NE):  the angle is measured from true north (positive y axis), clockwise

Southeast (SE):  the angle is measured from true south (negative y axis), counterclockwise

Southwest (SW): the angle is measured from true south (negative y axis), clockwise

Northwest (NW): the angle is measured from true north (positive y axis), counterclockwise


HP 42S/DM42 Program:  CNVANG 


00 { 263-Byte Prgm }

01▸LBL "CNVANG"

02 DEG

03 "∡?"

04 PROMPT

05 STO 00

06 "∡ CONVERSION"

07 AVIEW

08 ">COMP"

09 KEY 1 GTO 01

10 "NE>"

11 KEY 2 GTO 06

12 "SE>"

13 KEY 3 GTO 03

14 "SW>"

15 KEY 4 GTO 04

16 "NW>"

17 KEY 5 GTO 05

18 MENU

19▸LBL 00

20 STOP

21 GTO 00

22▸LBL 01

23 CLA

24 360

25 MOD

26 ENTER

27 ENTER

28 90

29 MOD

30 STO 00

31 X<>Y

32 90

33 ÷

34 IP

35 STO 01

36 0

37 X=Y?

38 GTO 07

39 R↓

40 1

41 X=Y?

42 GTO 08

43 R↓

44 2

45 X=Y?

46 GTO 09

47 GTO 10

48▸LBL 07

49 RCL 00

50 ARCL ST X

51 32

52 XTOA

53 78

54 XTOA

55 69

56 XTOA

57 GTO 01

58▸LBL 08

59 90

60 RCL- 00

61 STO 00

62 ARCL ST X

63 32

64 XTOA

65 83

66 XTOA

67 69

68 XTOA

69 GTO 01

70▸LBL 09

71 RCL 00

72 ARCL ST X

73 32

74 XTOA

75 83

76 XTOA

77 87

78 XTOA

79 GTO 01

80▸LBL 10

81 90

82 RCL- 00

83 STO 00

84 ARCL ST X

85 32

86 XTOA

87 78

88 XTOA

89 87

90 XTOA

91 GTO 01

92▸LBL 01

93 BEEP

94 AVIEW

95 GTO 11

96▸LBL 03

97 180

98 X<>Y

99 -

100 GTO 06

101▸LBL 04

102 180

103 +

104 GTO 06

105▸LBL 05

106 360

107 X<>Y

108 -

109 GTO 06

110▸LBL 06

111 STO 00

112 BEEP

113 CLA

114 "TRUE="

115 ARCL ST X

116▸LBL 11

117 CLMENU

118 EXITALL

119 RTN

120 .END.


TI-85 Program: CONVANG


ClLCD

"2020-12-31 EWS"

Degree

Input "θ? ",A

Menu(1,">COMP",A1,2,"NE>",A2,3,"SE>",A3,4,"SW>,A4,5,"NW>",A5)

Lbl A1

mod(mod(A,360),90)→B

iPart(A/90)→C

If C==0

Then

Outpt(3,1,B)

Outpt(3,17,"° NE ")

End

If C==1

Then

90-B→B

Outpt(3,1,B)

Outpt(3,17,"° SE ")

End

If C==2

Then

Outpt(3,1,B)

Outpt(3,17,"° SW ")

End

If C==3

Then

90-B→B

Outpt(3,1,B)

Outpt(3,17,"° NW ")

End

Lbl A2

A→B

Goto A6

Lbl A3

180-A→B

Goto A6

Lbl A4

180+A→B

Goto A6

Lbl A5

360-A→B

Goto A6

Lbl A6

Outpt(3,1,"TRUE= ")

Outpt(3,7,B)

Stop


Examples


To True Bearing:

35 NE> returns 35

74 SE> returns 106

20 SW> returns 200

76 NW> returns 284


From True Bearing:

35 >COMP returns 35 NE

106 >COMP returns 74 SE

200 >COMP returns 20 SW

284 >COMP returns 76 NW


Coming up in February:  a review of the TI-36 XII calculator, more programs for an old favorite, the TI-85, and much more.


Here's to the Groundhog delivering great news on 2/2/2021,


Eddie


All original content copyright, © 2011-2021.  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. 


Sunday, January 12, 2020

HP 42S/DM42/Free42: Predicting Freezing Levels and Turn Performance

HP 42S/DM42/Free42:  Predicting Freezing Levels and Turn Performance

Predicting Freezing Levels

The program FREEZE calculates the freezing elevation heights for two situations:

Dry:  Freezing level in clear weather.   The Aviation Pac (see source below) uses a drop rate of 2 °C/1000 ft in its calculation.

Wet:  Freezing level in clouds on a relatively clear day.  Accuracy tends to lessen for cloudy or rainy days.  The Aviation Pac (see source below) uses a drop rate of 1.5   °C/1000 ft in its calculation.

In general, the freezing level is calculated as:

FL = ALT + T * drop rate

ALT = altitude of the observer
T = temperature

The program FREEZE allows the user to choose from a set of units: (Fahrenheit vs. Celsius,  feet vs. meters).

1.  °F, ft
2.  °C, ft
3.  °F, m
4.  °C, m

HP 42S/DM42/Free42 Program FREEZE

00 { 204-Byte Prgm }
01▸LBL "FREEZE"
02 "TEMP?"
03 PROMPT
04 CLMENU
05 "°F FT"
06 KEY 1 GTO 01
07 "°C FT"
08 KEY 2 GTO 02
09 "°F M"
10 KEY 3 GTO 03
11 "°C M"
12 KEY 4 GTO 04
13 MENU
14▸LBL 00
15 STOP
16 GTO 00
17▸LBL 01
18 32
19 -
20 1ᴇ3
21 ×
22 ENTER
23 ENTER
24 3.6
25 ÷
26 X<>Y
27 2.7
28 ÷
29 GTO 05
30▸LBL 02
31 1ᴇ3
32 ×
33 ENTER
34 ENTER
35 2
36 ÷
37 X<>Y
38 1.5
39 ÷
40 GTO 05
41▸LBL 03
42 32
43 -
44 1ᴇ3
45 ×
46 ENTER
47 ENTER
48 1.09728
49 ÷
50 X<>Y
51 0.82296
52 ÷
53 GTO 05
54▸LBL 04
55 1ᴇ3
56 ×
57 ENTER
58 ENTER
59 0.6096
60 ÷
61 X<>Y
62 0.4572
63 ÷
64 GTO 05
65▸LBL 05
66 "ALTITUDE?"
67 PROMPT
68 STO+ ST Z
69 STO+ ST Y
70 R↓
71 CLMENU
72 EXITALL
73 "Y: DRY X:WET"
74 AVIEW
75 STOP
76 RTN
77 .END.

Example:
Temperature:  40 °F
Altitude:  3970 ft  (choose °F, ft)

Results:
Dry:  6192.2222 ft
Wet:  6932.9630 ft

Download freeze_level.raw here:  https://drive.google.com/open?id=13rIbpyxaR73DZnP-kau4r5i1PvQPo-_u

Turn Performance

The program TURN calculates four parameters when it comes to performance of an aircraft:

1.  The G-force

2.  The stall speed when bank angle is considered

3.  The diameter of an airplane's 360° turn

4.  The time it takes an airplane to turn 360°

The program sets the calculator to Degrees Mode.  The units are in feet for distance and knots for speed.

Memory Registers Used:

Input:
R01 = bank angle, in degrees (prompted)
R02 = true airspeed, TAS, in knots (prompted)
R03 = stall speed, in knots (prompted)

Output:
R04 = G-Force
R05 = turn diameter in nautical miles
R06 = time for a 360° to be completed in minutes
R07 = stall speed when bank angle is considered, in knots

HP 42S/DM42/Free42 Program TURN

00 { 157-Byte Prgm }
01▸LBL "TURN"
02 DEG
03 "SPEED IN KNOTS"
04 AVIEW
05 PSE
06 PSE
07 "TRUE AIR SPEED?"
08 PROMPT
09 STO 02
10 "NORM STALL?"
11 PROMPT
12 STO 03
13 "BANK? °"
14 PROMPT
15 STO 01
16 COS
17 1/X
18 STO 04
19 "G FORCE:"
20 ARCL ST X
21 AVIEW
22 STOP
23 SQRT
24 RCL× 03
25 STO 07
26 "STALL: "
27 ARCL ST X
28 AVIEW
29 STOP
30 RCL 01
31 TAN
32 1/X
33 RCL× 02
34 ENTER
35 ENTER
36 RCL× 02
37 34028
38 ÷
39 STO 05
40 "DIA: "
41 ARCL ST X
42 ├" N.M."
43 AVIEW
44 STOP
45 X<>Y
46 55ᴇ-4
47 ×
48 STO 06
49 CLA
50 ARCL ST X
51 ├" MIN"
52 AVIEW
53 .END.

Example:

Input:
True Air Speed (cruising speed):  107 knots
Stall speed:  54 knots
Bank:  30°

Output:
G Force:  1.1547
Stall:  58.0268 knots
Diameter:  0.5828 nautical miles
Time:  1.0193 minutes  (about 1 minute, 1.1 seconds)

Download turn_performance.raw here:  https://drive.google.com/open?id=1a_JFufFZUrRho44j-q4q25gy_BAZckr0

Source:

"Predicting Freezing Levels" and "Turn Performance"   HP 65 Aviation Pac 1.  Hewlett Packard, 1974


Eddie

All original content copyright, © 2011-2020.  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.

RPN: DM32 and DM42: Stopping Sight Distance (Metric)

RPN: DM32 and DM42: Stopping Sight Distance (Metric) The Stopping Sight Distance Formula – Derivation The stopping sight di...