## Thursday, December 29, 2016

### PCalc 42 User Functions ( iOS )

PCalc 42 User Functions ( iOS )

Programs for the iOS App PCalc 42 from Previous Posts (during May 2014):

Time to revisit this app:

PCalc42 Decimal to Degrees-Minutes-Seconds (d.mmssss form):
D > DMS

Switch to Decimal
Set R0 to X
Truncate X
Set R1 to R0
Subtract X from R1
Multiply R1 by 60
Set R2 to R1
Subtract X from R1
Multiply R1 by 60
Set R2 to R1
Truncate R1
Multiply R1 by 0.01
Set R3 to R2
Truncate R3
Subtract R3 from R2
Multiply R2 by 0.006

Example:   1.85 in DMS form is 1.51 (1° 51’)

PCalc42 Degrees-Minutes-Seconds (d.mmssss form) to Decimal
DMS > D

Switch to Decimal
Set R0 to X
Truncate X
Set R1 to R0
Subtract X from R1
Multiply R1 by 100
Set R2 to R1
Truncate R1
Subtract R1 from R2
Divide R2 by 60
Multiply R2 by 100
Divide R2 by 60

Example:  1.3052 (1° 30’ 52”) in decimal form is 1.514444444

PCalc42 Snell’s Law of Refraction

Input: Y: n1, X: n,  n1 ≤ n2

Switch to Degrees
Invert X
Multiply Y by X
Inverse Sine X

Example:  n1 = 1.33, n2 = 1.50.   Output:  62.4573248455

PCalc42 Doppler Effect (RPN)  (SI Units)

Input:  Z:  emitted frequency (Hz), Y:  receiver velocity (m/s), X: source velocity (m/s)
Output:  observed frequency (Hz) on stack X

Negate X
RPN Swap
RPN Roll Down
Divide X by 299752458
Multiply Y by X
RPN Roll Down

Example:
Z:  Emitted Frequency:  525 Hz
X:  Source Velocity:  208,000,000 ft/s

Output:  Observed Frequency:  535.5086711249 Hz

PCalc42 Sums (RPN) Σ m, Σ m^2, Σ m^3

The sum of Σ m^X from m = 1 to m = Y, where X is the power, Y is the power (up to 3).  If Y > 3, an error condition occurs.

Formulas:
Σ m = (X^2 + X) / 2
Σ m^2 = (2*X^3 + 3*X^2 + X) / 6
Σ m^3 = (X * (X+1))^2 / 4

Set R0 to Y
Truncate X
Skip 3 if X = 1
Skip 7 if X = 2
Skip 16 if X = 3
Error
RPN Roll Down
X To Power of 2
Divide X by 2
Stop
RPN Roll Down
X To Power of 3
Multiply X by 2
Set R1 to R0
R1 To Power of 2
Multiply R1 by 3
Divide X by 6
Stop
RPN Roll Down
Multiply X by R0
X To Power of 2
Divide X by 4

Example:
Y = 6, X = 1:  Sum is 21
Y = 6, X = 2:  Sum is 91
Y = 6, X = 3:  Sum is 441

PCalc42 Present Value Factor of a Single Sum

PV:  (1 + Y/100)^-X

Y:  interest rate
X:  periods

Negate X
Divide Y by 100
Y To Power of X
RPN Roll Down

Example:  Y = 7 (7%), X =  5 (n = 5)
Output:  0.7129861795

Happy New Year’s Everyone! See you in 2017!

Eddie

This blog is property of Edward Shore, 2016.