Sunday, December 24, 2023

TI-73 (Explorer): Percents and Random Fractions

TI-73 (Explorer):  Percents and Random Fractions



TI-73 Program:  PERCENT





TAX+:  Appropriately add a percent to a number.   Application:  Sales Tax


TAX-:   Appropriately subtract a percent from a number.  Application:  Discount


% CHANGE:  Percent change from the old number to new number.  Additional application:  Percent Markup (OLD = cost, NEW = selling price)


%TOT:  Finds the percentage portion of a total number


% MARGIN:  Given an item's cost and selling price, calculate the item's percent margin.  



Code:

(spaces added for clarity)


"EWS 2023-12-02"     // (comment)


Lbl 0

Menu("PERCENT","TAX+",1,"TAX-",2,

"% CHANGE",3,"%TOT",4,"% MARGIN",5,

"EXIT",E)


Lbl 1

Prompt N

Input "X% ",X

N*(1+X%)→Y

Disp "ANSWER="

Pause Y

Goto 0


Lbl 2

Prompt N

Input "X% ",X

N*(1-X%)→Y

Disp "ANSWER="

Pause Y

Goto 0


Lbl 3

Input "OLD=",O

Input "NEW=",N

(N-O)*100/O→Y

Disp "% CHANGE="

Pause Y

Goto 0


Lbl 4

Input "PART=",P

Input "WHOLE=",W

100*P/W→Y

Disp "%"

Pause Y

Goto 0


Lbl 5

Input "COST=",C

Input "SELL PRICE=",S

(S-C)/S*100→Y

Disp "% MARGIN="

Pause Y

Goto 0


Lbl E

Disp "BYE"

Pause



Note:   Results that are to be displayed need to be followed or accompanied by a Pause command, unless the results will not show.  This wrinkle is unique to the TI-73.  

Link to download PERCENT.73p



TI-73  Program:  RANDFRAC




Generate a number of fractions with randomized numerators and denominators.  


T = number of fractions to be generator

L = upper limit that the numerator and denominator can take.  The numbers range from 1 to L


The result is returned in three parts:


numerator

denominator

fraction


For example:


5

7

5/7


Simplification rules are set through the MODE key.  


Code:

(spaces added for clarity)


"EWS 2023-12-02"     // (comment)


Disp "NO. FRACTIONS"

Prompt T

Disp "UPPER LIMIT"

Prompt L


For(I,1,T)

randInt(1,L)→N

randInt(1,L)→D

N ⁄ D→F     // N [ b/c ] D [ STO> ] F

Disp N,D,F

Pause

End


Note:  The fraction symbol pressed by [ b/c ], symbolized by  ⁄, shows on the screen as a thick division slash.   


Link to download RANDFRAC.73p


For those of you who are celebrating, Merry Christmas!


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, December 23, 2023

Swiss Micros DM32: Solving Integral Equations

Swiss Micros DM32:  Solving Integral Equations



Introduction


The programs presented today solves the following equation for X:


X

∫   F(T)  dT = C

0


Since we are not able to use an integration command in solving a program on the DM32 (and the HP 32S and 32SII), we will have to use a manual method, mainly Newton's Method:


X_n+1 = X_n - [ ∫( F(T) dT from T = 0 to T = x_n) - C ] ÷ f(x_n) 


with in tolerance D.


To see a similar program for the HP Prime, posted on April 3, 2020, please click here:

https://edspi31415.blogspot.com/2020/04/hp-prime-solving-integral-equations.html



DM32 Code:  Integral Equations


LBL H:  Help File


 LBL H

  SF 10

  EQN: L B L _ F - F ( T )

  EQN: L B L _ S - S O L V E

  EQN: S _ H A S _ R C L _ T

  EQN: C = C O N S T

  EQN: D = T O L E R

  EQN: G U E S S _ X E Q _ S

  CF 10

  RTN


Note:  Underscore is the space key.   Press R/S after each message.   


LBL F

  RCL T

  enter f(T), the integrand, here

  RTN


Note:  The variable used is T.   If you want to test out the function, store a value in the variable T first.  


 LBL S

  RAD

  STO X

  LBL A

  FN= F

  0

  RCL X

  ∫ FN d T

  RCL- C

  STO Y

  RCL X

  STO T

  XEQ F

  STO÷ Y

  RCL X

  RCL- Y

  STO Y

  RCL Y

  RCL- X

  ABS

  RCL D

  x<y?

  GTO B

  RCL Y

  RTN

  LBL B

  RCL Y

  STO X

  GTO A


Note:  This is the main program.  Enter a guess, and then key in XEQ S.  



Variables Used:


T = independent variable

C = constant

D  = tolerance (i.e. 10^-4, 10^-5, 10^-6, etc)

X = x_n

Y = x_n+1, final approximation



Download the state file here:  ntegralequ.dm32



The state file includes a sample integrand:


e^(-T ÷ 4):


LBL F

RCL T

x^2

+/-

4

÷

e^x

RTN



Examples



In the following examples, the tolerance is 10^-5  (5 +/- 10^x STO D) and FIX 5 mode is set.  


1.   ∫( e^(-T^2 ÷ 4) dT for T = 0 to X) = 1


C = 1


Guess = 2,   Result:  1.10208

Guess = 1,   Result:  1.10208

Guess = 3,   Result:  Division by 0 error


Note that initial guesses are important.  



2.  ∫( e^-sin(T + 1) dT for T = 0 to X) = 10


C = 10


LBL F

RCL T

1

+

SIN

+/-

e^x

RTN


Guess = 5;  Result:  9.10014



3.  ∫( T^3 - 2 × T dT for T = 0 to X) = 40


C = 40


LBL F

RCL T

3

y^x

RCL T

2 

×

-

RTN


Guess = 5; Result:  3.84789



4.  ∫( sin^2 T dT for T = 0 to X) = 1.4897


C = 1.4897


LBL F

RCL T

SIN

x^2

RTN


Guess = 2;  Result:  2.49991




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, December 17, 2023

HP 15C and HP 71B: Precession of the Equinoxes

HP 15C and HP 71B:   Precession of the Equinoxes



How Far Does the Celestial Object Move?  


Given a celestial object's right ascension (α) and declination (δ), we can calculate the new positions after N years by the formulas presented by The Cambridge Handbook of Physics Formulas (see Source):


α' ≈ α0 + (3.075" + 1.336" × sin α0 × tan δ0) × N


δ' ≈ δ0 + (20.043" × cos α0) × N



Decimal degrees of seconds:


3.075" ≈ 854.1677 × 10^-6


1.336" ≈ 371.1111 × 10^-6


20.043" ≈ 5.5675 × 10^-3



According to the Handbook, the formulas are good for only several centuries, as the formulas are local approximations.  




HP 15C Code:  New Right Ascension (LBL A) and New Declination (LBL D)


Step:  Key Code:  Key



New Right Ascension, α'


001:  42, 21, 11:  LBL A

002:  __, 43, _7:  DEG

003:  __, __, _1:  1

004:  __, __, _3:  3

005:  __, __, _3:  3

006:  __, __, 48:  .

007:  __, __, _6:  6

008:  __, __, 26:  EEX

009:  __, __, _6:  6

010:  __, __, 16:  CHS

011:  __, 43, _2:  →H

012:  __, 45, _1:  RCL 1

013:  __, 43, _2:  →H

014:  __, __, 23:  SIN

015:  __, __, 20:  ×

016:  __, 45, _2:  RCL 2

017:  __, 43, _2:  →H

018:  __, __, 25:  TAN

019:  __, __, 20:  × 

020:  __, __, _3:  3

021:  __, __, _0:  0

022:  __, __, _7:  7

023:  __, __, 48:  .

024:  __, __, _5:  5

025:  __, __, 26:  EEX

026:  __, __, _6:  6

027:  __, __, 16:  CHS

028:  __, 43, _2:  →H

029:  __, __, 40:  +

030:  45, 20, _3:  RCL× 3

031:  __, 45, _1:  RCL 1

032:  __, 43, _2:  →H

033:  __, __, 40:  +

034:  __, 42, _2:  →H.MS

035:  __, 44, _4:  STO 4

036:  __, 43, 32:  RTN


New Declination:  δ'


037:  42, 21, 14:  LBL B

038:  __, 43, _7:  DEG

039:  __, __, _2:  2

040:  __, __, 48:  .

041:  __, __, _0:  0

042:  __, __, _0:  0

043:  __, __, _4:  4

044:  __, __, _3:  3

045:  __, __, 26:  EEX

046:  __, __, _3:  3

047:  __, __, 16:  CHS

048:  __, 43, _2:  →H

049:  __, 45, _1:  RCL 1

050:  __, 43, _2:  →H

051:  __, __, 24:  COS

052:  __, __, 20:  × 

053:  45, 20, _3:  RCL× 3

054:  __, 45, _2:  RCL 2

055:  __, 43, _2:  →H

056:  __, __, 40:  +

057:  __, 42, _2:  →H.MS

058:  __, 44, _5:  STO 5

059:  __, 43, 32:  RTN



Variables Used:


R1 = α0:  Initial Right Ascension (enter in DD.MMSS format)

R2 = δ0:  Initial Declination  (enter in DD.MMSS format)

R3 = N:  Number of Years from 2000.  


Outputs:


R4 = α':  Final Right Ascension (in DD.MMSS format)

R5 = δ':  Final Declination  (in DD.MMSS format)



HP 71B Code:   PRECES


Note:  I had battery problems with the HP 71B, so I'm writing this code from written notes.  


100  DEGREES

110  PRINT "PRECESSION" @ WAIT 0.25

120  PRINT "EPOCH J2000.0"  @ WAIT 0.25

130  INPUT "R.A. °,M,S ?"; H,M,S

140  GOSUB 500 @ A0 = X

150  INPUT "DEC °,M,S? "; H,M,S

160  GOSUB 500 @ D0 = X

170  INPUT "# YEARS? "; N

180  A1 = A0 + (854.1667E-6 + 371.1111E-6 * SIN(A0) * TAN(D0)) * N

190  D1 = D0 + (5.5675E-3 * COS(A0)) * N

200  X = A1 @ GOSUB 600 

210  H1 = H @ M1 = M @ S1 = S @ G1 = G

220  PRINT "R.A. ADJ=" @ WAIT 0.25

230  PRINT G1*H1; "°"; M1; "m"; S1; "s" @ PAUSE

240  X = D1 @ GOSUB 600

250  H2 = H @ M2 = M @ S2 = S @ G2 = G

260  PRINT "DEC ADJ=" @ WAIT 0.25

270  PRINT G2*H2; "°"; M2; "m"; S2; "s"

280  END


500  X=SGN(H) * (ABS(H) + M/60 + S/3600)

510  RETURN


600  G = SGN(X) @ X=ABS(X) @ H=IP(X)

610  M = IP(FP(X) * 60)

620  S = FP(FP(X) * 60) * 60

630  RETURN



Examples



First Point of Aries (Vernal Equinox)


α0 = 0° 00' 00"

δ0 = 0° 00' 00"


N = 100

α' ≈ 5'08" (0.0508)

δ' ≈ 33'24"  (0.3324)



Regulus (Alpha Leonis (Leo))


α0 ≈ 5° 55' 10"

δ0 ≈ 7° 24' 25"


N = 100

α' ≈ 6° 00' 19"

δ' ≈ 7° 57' 39"  


Sagittarius A*  (Center of the Milky Way Galaxy)


α0 ≈ 17° 45' 40"

δ0 ≈ -29° 00' 28"


N = 100

α' ≈ 17° 50' 25"

δ' ≈ -28° 28' 39"  



Betelgeuse (Alpha Orionis (Orion))


α0 ≈ 10° 28' 22"

δ0 ≈ 11° 58' 02"


N = 100

α' ≈ 10° 13' 34"

δ' ≈ 12° 30' 55"  



Source


Woan, Gaham.   The Cambridge Handbook of Physics Formulas  2003 Edition. Cambridge University Press.  2000. ISBN 978-0-511-07589-6



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, December 16, 2023

HP 12C: Simple Interest

HP 12C:   Simple Interest


Some short-term loans and accounts accrue interest using the simple interest method.   This is different from the conventional compound interest method.  


Simple Interest Formula


T = B + B × R% × N = P × (1 + R% × N)


T = total future value (uses the FV register)

B = beginning value (uses the PV register)

R = annual interest rate (uses the i register)

N = time in years (uses the n register)


The program uses four of the TVM registers for the purpose of storing registers in a convenient way.  



HP 12C Code:  Simple Interest


Step :  Key Code  :  Key


# Solve for the future value, GTO 01, R/S


01:  __, 45, 13:  RCL PV

02:  __, 45, 12:  RCL i

03:  __, 45, 11:  RCL n

04:  __, __, 20:  ×

05:  __, __, 25:  %

06:  __, __, 40:  +

07:  __, 44, 15:  STO FV

08:  43, 33, 00:  GTO 00


# Solve for the present value, GTO 09, R/S 


09:  __, 45, 15:  RCL FV

10:  __, __, _1:  1

11:  __, 45, 12:  RCL i

12:  __, 45, 11:  RCL n

13:  __, __, 20:  ×

14:  __, __, 25:  %

15:  __, __, 40:  +

16:  __, __, 10:  ÷

17:  __, 44, 13:  STO PV

18:  43, 33, 00:  GTO 00


#  Solve for the time in years, GTO 19, R/S


19:  __, 45, 15:  RCL FV

20:  __, 45, 13:  RCL PV

21:  __, __, 10:  ÷

22:  __, __, _1:  1

23:  __, __, 30:  -

24:  __, 45, 12:  RCL i

25:  __, __, 10:  ÷

26:  __, __, _1:  1

27:  __, __, 26:  EEX

28:  __, __, _2:  2

29:  __, __, 20:  ×

30:  __, 44, 11:  STO n

31:  43, 33, 00:  GTO 00


# Solve for the interest rate, GTO 32, R/S 


32:  __, 45, 15:  RCL FV

33:  __, 45, 13:  RCL PV

34:  __, __, 10:  ÷

35:  __, __, _1:  1

36:  __, __, 30:  -

37:  __, 45, 11:  RCL n

38:  __, __, 10:  ÷

39:  __, __, _1:  1

40:  __, __, 26:  EEX

41:  __, __, _2:  2

42:  __, __, 20:  ×

43:  __, 44, 12:  STO i

44:  43, 33, 00:  GTO 00



Summary


T = B + B × R% × N


To solve for T:  GTO 01, [ R/S ]

To solve for B: GTO 09, [ R/S ]

To solve for N:  GTO 19, [ R/S ]

To solve for R:  GTO 32, [ R/S ]



Examples


1.   What is the interest rate required if you begin with $1,000.00 and end up with $1,135.00 in 5 years?  Assume that account accrues using simple interest.


1000 [ PV ] 

1135 [ FV ]

5 [ n ]

GTO 32, [ R/S ]


Answer:  2.70%.  


2.  An auto loan of $8,000.00 is to paid back in 60 monthly payments (5 years).  The loan's rate is 6% at simple interest.   What is the monthly payment of this loan?


The first step is to find the total amount:


8000 [ PV ]

6 [ i ] 

5 [ n ]

GTO 01, [ R/S ]


T = $10,400.00  (total plus interest)


[ RCL ] [ FV ] 60 [ ÷ ]


Monthly payment with simple interest:  $ 173.33



Source


Hayes, Adam.  "Simple Interest: Who Benefits, With Formula and Example"  Investopedia.  Last updated May 27, 2023.  Retrieved November 19, 2023.  

URL:  https://www.investopedia.com/terms/s/simple_interest.asp




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, December 10, 2023

HP 71B and HP 75C: Degrees and DMS Conversions

HP 71B and HP 75C:  Degrees and DMS Conversions



At default, the HP 71B and HP 75C do not have conversions between degrees and degrees-minutes-seconds.   Here are two short programs to remedy this and can be used as subroutines.  The language used is BASIC.



HP 71B and HP 75C Code:  DMS to Degrees.  File Name: DMS2D


10 INPUT "d, m, s? ": H, M, S

20 D=SGN(H)*(ABS(H)+M/60+S/3600)

30 PRINT D; "°"




HP 71B and HP 75C Code:   Degrees to DMS.   File Name:  D2DMS


10  INPUT "DEC DEG? "; D

20 G=SGN(D) @ D=ABS(D) @ H=IP(D)

30 M=IP(FP(D)*60)

40 S=FP(FP(D)*60)*60

50 PRINT G*H; "°"; M; "m"; S; "s"



Notes:  


1.  The degree character, °, can be typed by the following combinations:

HP 71B:  g, CTRL, A

HP 75C:  CTL + A


2.  When entering DMS, separate degrees, minutes, and seconds by commas.  For negative degrees in DMS format, enter the negative sign in front of degrees.  


3.  Repeating decimals (like 42.606666666...) may produce approximate conversions.  



Examples to Try


43.25° ←→ 43° 15m 0s 


-63.27°  ←→ -63° 16m 12s


42.60166667° ←→ 42° 36m 6s  (about)




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, December 9, 2023

Swiss Micros DM32 and Casio fx-4000P: Prime Factorization

Swiss Micros DM32 and Casio fx-4000P:   Prime Factorization



Introduction 



On March 22, 2017, I posted a prime factorization program for the HP 15C:


https://edspi31415.blogspot.com/2017/03/hp-15c-prime-factorization.html



Today's blog is a port for the:


* Swiss Micros DM32 (and HP 32SII family)

* Casio fx-4000P



Swiss Micros DM32 Code:  Prime Factorization



Instructions:


1.  Enter a positive integer on the X stack. 

2.  Run the program (XEQ P) and a prime factor is displayed.  Press [ R/S ] to continue.  At this point the calculator is set to FIX 0 mode.   Repeat step 2.

3.  The program ends when the integer reappears.  The calculator is reset to FIX 4.  


3 labels are needed.



P01  LBL P

P02  FIX 0

P03  STO B

P04  STO A

P05  2

P06  STO F


B01  LBL B

B02  RCL A

B03  RCL÷ F

B04  ENTER

B05  FP

B06  x=0?

B07  GTO A

B08  1

B09  STO+ F

B10  GTO B


A01  LBL A

A02  RCL F

A03  STOP

A04  R↓

A05  R↓

A06  STO A

A07  1

A08  -

A09  x≠0?

A10 GTO B

A11 RCL B

A12 FIX 4

A13 RTN



Labels used:  P, B, A

Variables:  F (factor), A, B





Casio fx-4000P Code: Prime Factorization



Instructions:


1.  Run program (P#) in RUN Mode (Mode 1).  

2.  Enter a positive integer at the "N?" prompt.  

3.  A prime factor is displayed.  Press [ EXE] to continue. Repeat step 3.

4.  The program ends when the integer reappears.  



"N" : ? → N : N → T : 2 → F : 

Lbl 3 : Frac( T ÷ F ) = 0 ⇒ Goto 2 :

F + 1 → F : Goto 3 :

Lbl 2 : F ◢ T ÷ F → T : T - 1 ≠ 0 ⇒ Goto 3 : N


Variables:  N, T, F  




Examples


26:  2, 13, 26   (26 = 2 × 13)


89:  89   (89 is prime)


175:  5, 5, 7, 175   (175 = 5^2 × 7)


1020:  2, 2, 3, 5, 17, 1020  (1020 = 2^2 × 3 × 5 × 17)




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, December 3, 2023

Casio fx-5000F: Auto Formulas

Casio fx-5000F:   Auto Formulas



The formula listing can apply to (almost) any calculator that can handle formula programming.


In November, there I want to a luncheon that a local car club had in Riverside.  Of course, this was an opportunity to bring a calculator and find something in common with the members.   I previously did this with a TI-68.


Except noted, US, imperial units are used.  


The source for all the equations are from The Auto Math Handbook, except for Gas Efficiency.  




Stroke of an Engine

(spaces added for readability)


S = D / ( π / 4 × B^2 × n ) = D / ( π / 4 × B² × n )


S = stroke (in)

D = displacement (in^3)

B = bore (in)

n = number of cylinders


Example:

D = 421

B = 4 

n = 6


Result: 

S ≈ 5.58369 in 



Engine Horsepower


H = R × T × 2 × π / 33000


H = engine horsepower (hp)

R = revolutions per minute (rpm)

T = torque (lbs-ft)


Example:

R = 5200 

T = 446


Result:

H ≈441.57465



Theoretical Air Capacity of an Engine


C = R × D / 3456


C = air capacity (in^3/min [cubic feet per minute])

R = revolutions per minute (rpm)

D = displacement (in^3)


Example:

R = 5200

D = 421 


Result:

C ≈ 633.44907



Estimated Elapsed Time in a Quarter Mile


The time is based off an engine's weight (really, mass) and horsepower.


E = 5.825 × ³√( W / H ) = 5.825 × ( W / H )^(1/3)


E = elapsed time in seconds (sec)

W = weight of the automobile/truck (pounds)

H = horsepower of the engine (hp)


Example:

W = 3676 

H = 440


Result:

E ≈ 11.81962



Gear Ratio 


This estimates the final gear ratio.  Note that 63360 ÷ 60 = 1056, allowing a simplified formula to be used.


G = R × T × θ / M / 1056


G = gear ratio

R = revolutions per minute (rpm)

T = tire diameter (in)

M = miles per hour (mph) (average)


Example:

R = 5200

T = 28

M = 57.8


Result:

G ≈ 7.49410



Tire Diameter


T = W × A / 1270 + R


Take the following measurements as they are marked on the tire:


[LT/P]  W / A  [R/B]   R


W = section width (mm:  yes, somehow U.S. tires measure this in millimeters)

A = aspect ratio (percentage difference between section height and section width)

R = rim diameter (in)


T = tire diameter (in)


Example:

W = 235

A = 75

R = 15


Result:

D ≈ 28.87795



Gas Efficiency


M = (B - A) / g


B = ending mileage (mi)

A = beginning mileage (mi)

g = number of gallons used


M = gas efficiency (mpg, miles per gallon)


Example:

B = 13695

A = 13385

G = 10


Result:

M = 31



Source


Lawlor, John.   Auto Math Handbook:  Calculations, Formulas, Equations and Theory  HPBooks  New York, NY 1992.



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, December 2, 2023

Swiss Micros DM41X and Numworks: Fresnel Reflection Calculations

Swiss Micros DM41X and Numworks:  Fresnel Reflection Calculations



Introduction



Given the following:


ni:  incident refractive index  (input)


nt:  incident transmitted index (output)


θi:  angle of incidence, in degrees



The following are calculated:



θt:  angle of transmission, in degrees


θt = arcsin(ni × sin θi ÷ nt)



θb:  angle as determined by Brewster's law


θb = arctan(nt ÷ ni)



R:  power reflectance coefficient


R = (ni - nt)^2 ÷ (ni + nt)^2



T:  power transmitted coefficient


T = 1 - R




Swiss Micros DM41X Code:   FRES


01  LBL^T FRES

02  DEG

03 ^T N.I?

04  PROMPT

05  STO 01

06  CLA

07  29

08  XTOA

09  ^T |- .I?

10  PROMPT

11  STO 03

12  ^N.T?

13  PROMPT

14  STO 02

15  RCL 01

16  RCL 02

17  /

18  RCL 03

19  SIN

20  *

21  ASIN

22  STO 04

23  CLA

24  29

25  XTOA

26  ^T |- .T=

27  ARCL 04

28  AVIEW

29  STOP

30  RCL 02

31  RCL 01

32  /

33  ATAN

34  STO 05

35  CLA

36  29

37  XTOA

38  ^T |- BRW=

39  ARCL 05

40  AVIEW

41  STOP 

42  RCL 01

43  RCL 02 

44  -

45  RCL 01

46  RCL 02

47  +

48  /

49  X↑2

50  STO 06

51  ^T R=

52  ARCL X

53  AVIEW

54  STOP

55  1

56  X<>Y

57  -

58  STO 07

59  ^T T=

60  ARCL X

61  AVIEW

62  END  



Numworks - Python Code:  fres.py


from math import *

print("Fresnel Equations")

print("Electrical Fields")

print("(angles are in degrees)")


ti=float(input("\u03b8.i? "))

ai=radians(ti)


ni=float(input("n.i? "))

nt=float(input("n.t? "))


at=asin(ni/nt*sin(ai))

tt=degrees(at)


ab=atan(nt/ni)

tb=degrees(ab)


r=((ni-nt)/(ni+nt))**2

t=1-r



print("\n\u03b8.t =",tt)

print("Brewster's Law=\n",tb)

print("Reflect Coef.=\n",r)

print("Trans. Coef.=\n",t)



Example


Inputs:  

θi: 46°

ni: 1.33

nt: 1.5


Outputs:

θt ≈ 39.6291°

θb ≈ 48.4377°

R ≈ 0.0036

T ≈ 0.9964



Sources


R. Paschotta, article on 'Fresnel equations' in the RP Photonics Encyclopedia, accessed on 2023-11-04.  URL:  https://www.rp-photonics.com/encyclopedia_cite.html?article=Fresnel%20equations


Woan, Gaham.   The Cambridge Handbook of Physics Formulas  2003 Edition. Cambridge University Press.  2000. ISBN 978-0-511-07589-6



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, 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. 


HP 15C: The I Squared Rule and HHC 2026

HP 15C: The I Squared Rule and HHC 2026 HHC 2026 Videos Before we start, the videos for HHC 2026 are up! Please take a look, ev...