Tuesday, October 27, 2015

Casio fx-3650p: Programming - The Sequel

Casio fx-3650p: Programming - The Sequel

Time to revisit the Casio fx-3650p.  Since the last time I did this, Casio released an updated fx-3650p.  I still have the older version.  And still, the fx-3650p is not sold in the United States (sigh).

Since the language of the fx-3650p is similar to the Casio graphing calculators and fx-5800p (in fact it is simplified, you can adopt and port these programs.)

Contents for this blog:
1.  Combination with Replacement
2.  Great Circle (Distance in km)
3.  Orbital Speed and Period
4.  Eccentricity and Area of an Ellipse
5.  Super Factorial
6.  Escape Velocity
7.  Finance: Payment of a Monthly Mortgage
8.  Wind Chill Factor
9.  Speed of Sound in Dry Air

Combination with Replacement

Formula: nCr(A + B - 1, B)

Program: (17 steps)
? → A : ? → B :
(A + B - 1) [nCr] B

Example:
A = 17, B = 8, Result: 735,471
A = 52, B = 5, Result: 3,819,816

Great Circle (Distance in km)

Input:
A = latitude 1 (North is positive), B = longitude 1 (East is positive)
C = latitude 2, D = longitude 2

Program: (49 steps)
? → A : ? → B : ? → C : ? → D :
cos⁻¹ ( sin A sin C + cos A cos C cos (B - D → Y :
Y * 6371 * π ÷ 180 → Y

Example: Los Angels to Rome
Los Angeles:  Lat 34°03' N, Long 118°15' W (enter as negative)
Rome: Lat 41°54' N, Long 12°30' E

Result: (approx) 10,189.94397 km

Orbital Speed and Period

Input:
A = Mass 1 (kg), B = Mass 2 (kg), D = Distance (m)

Output:
X = Orbital Speed (m/s), Y = Time for One Orbit to complete (in years)

Program: (61 steps)
? → A : ? → B : ? → D : 6.67384E-11 ( A + B → C :
√ ( C ÷ D → X ◢ 2 π √ ( D³ ÷ C → Y : Y ÷ 315576000 → Y

Example:
Sun: 1.989E30 kg (A)
Earth: 5.927E24 kg (B)
Avg. distance between Sun and Earth: 1.496E11 m (D)

Results:
Orbital Speed (Earth around Sun): 29787.91714 m/s (X)
Orbital Period: 0.999924841 yrs (Y)

Eccentricity and Area of an Ellipse

Ellipse with semi-axis lengths A and B, assuming that A ≤ B.

Program: (25 steps)
? → A : ? → B :
√ ( 1 - A² ÷ B²  → C ◢ π A B → D

Example:
A = 5, B = 10

Results:
Eccentricity: 0.866025403 (C)
Area: 157.0796327 (D)

Super Factorial

Formula: spf(n) =   product(X!, X, 1, n)

For the Casio, n is an integer where 1 ≤ n ≤ 16

Source for formula:
Martin, Ángel M.  Sandmath_44: Math Extensions for the HP 41. Rev 44_E. 2012

Program: (35 steps)
? → A : 1 → Y : 1 → M : Lbl 0 :
M! * Y → Y : 1 M+ : A > M - 1 ⇒ Goto 0 : Y

Examples:
spf(1) = 1
spf(2) = 2
spf(3) = 12
spf(4) = 288

Escape Velocity

Input:
A = mass (kg), D = radius (m)

Output:
Escape velocity in m/s

Program: (27 Steps)
? → A : ? → D :
√ ( 2 * 6.67384E-11 * A ÷ D

Example:
A = 5.927E24 kg (mass of Earth)
D = 6.371E3 m (radius of Earth)

Result: 11,143.37008 m/s

Finance: Payment of a Monthly Mortgage

Input:
A = Loan Amount
C = Annual Interest Rate
D = Number of payments

Output:
B = Monthly Payment

End of month payments are assumed.  No balloon amounts are assumed.  The program is set up to mimic behavior on most financial calculators (negative for outflows, positive for inflows).

Program: (40 Steps)
? → A : ? → C : ? → D : C ÷ 1200 → X :
- A * X ÷ ( 1 - ( 1 + X ) ^ -D ) → B

Example:
A = 400,000
C = 5%
D = 360

Result:
B = -2,147.286491 (payment of 2,147.29 per month)

Wind Chill Factor (US Units)

Source for formula:
Glover, Thomas J.  Pocket Ref. 4th Edition.  Sequoia Publishing Inc.  Littleton, CO.  2012

Input:
A = temperature in °F
B = speed of the wind in mph

Output:
C = Wind Chill in °F

Program: (47 steps)
? → A : ? → B : 35.74 + .6215 A
- 35.75 B^.16 + .4275 * A * B^.16 → C

Example:
A = 45°F
B = 15 mph

Result:
C = 38.23993448 °F

Speed of Sound in Dry Air

C = √ ( γ R (T + 273.15))

γ = 1.4 (ratio of specific heat of dry air)
R = 286.9 J/(kg K) (Individual Gas Constant)
T = temperature in °C

Sources:

"Speed of Sound" NASA.  Glenn Research Center.
Retrieved October 27, 2015

"The Individual and Universe Gas Constant".  The Engineering Toolbox.
Retrieved October 27, 2015

Input:
C = temperature in °C

Output:
Speed of sound in m/s

Program: (25 Steps)
? → C : √(  1.4 * 286.9 * (C + 273.15

Example:
For 20°C, the speed of sound is approximately 343.1422868 m/s

Enjoy!  Happy Halloween!

Eddie

This blog is property of Edward Shore. 2015