Showing posts with label monthly payment. Show all posts
Showing posts with label monthly payment. Show all posts

Saturday, September 28, 2019

fx-260 Solar Algorithms Part I

fx-260 Solar Algorithms Part I

All results are shown to screen accuracy. 

Sphere:  Surface Area and Volume

With the radius r,
the surface area is S = 4 * π * r^2
the volume area is V = 4/3 * π * r^3

Algorithm:
r  [SHIFT] (Min) [ x² ] [ × ] [EXP](π) [ × ] 4 [ = ]    // surface area is displayed
[ × ] [ MR ] [ ÷ ] 3 [ = ]   // area is displayed

M = r

Example:
Input:
r = 3.86

Results:
3.86  [SHIFT] (Min) [ x² ] [ × ] [EXP](π) [ × ] 4 [ = ]   
Surface Area = 187.2338956

[ × ] [ MR ] [ ÷ ] 3 [ = ] 
Volume = 204.9076123

Monthly Payment of a Mortgage or Auto Loan

Input:
A = amount of the mortgage/loan
I = annual interest rate
N = number of months

The monthly payment can be found by:
PMT = ( 1 - (1 + I/1200)^-N) / (I/1200)

Algorithm:
I [ ÷ ] 1200 [ = ] [SHIFT] (Min)   // stores I/1200 into M
1 [ - ] [ ( ] 1 [ + ] [ MR ] [ ) ] [ x^y ] N [ +/- ] [ = ]
[SHIFT] (1/x) [ × ] [ MR ] [ × ] A [ = ]     // monthly payment

Example:
Input: 
I = 4  (4%)
N = 360
A = 85000

Result:
4 [ ÷ ] 1200 [ = ] [SHIFT] (Min)   // stores I/1200 into M
1 [ - ] [ ( ] 1 [ + ] [ MR ] [ ) ] [ x^y ] 360 [ +/- ] [ = ]
[SHIFT] (1/x) [ × ] [ MR ] [ × ] 85000 [ = ]     // monthly payment

PMT = 405.8030014   ($405.80)
(I/1200 = M = 3.333333333E-03)

Electromagnetic Field Strength 

Given the EIRP (effective isotropic radiated power) of a microwave (in Watts), we can calculate the following:

Power Flux Density: 
S = EIRP / (4 * π * d^2)   (W/m^2,  d = distance from the wave source in meters)

Electric Field:
E = √(30 * EIRP) /  d   (W/m)

Magnetic Field:
H = √(EIRP / (480 * π^2 * d^2) )  (A/m)

Algorithm:

Calculating Power Flux: 
EIRP [ ÷ ] [ ( ] 4 [ × ] [EXP](π) [ × ]  d [ x² ] [ ) ] [ = ]

Calculating Electric Field: 
[ ( ] EIRP [ × ] 30 [ ) ] [SHIFT] (√) [ ÷ ] 0.5 [ = ]

Calculating Magnetic Field:
[ ( ] EIRP [ ÷ ] [ ( ] 480 [ × ] [EXP](π) [ x² ] [ × ] d [ x² ] [ ) ] [ ) ] [ √ ] [ = ]

Example:
Input:
EIRP = 1800 W
d =  0.5 m   (distance)

Results:

Calculating Power Flux: 
1800 [ ÷ ] [ ( ] 4 [ × ] [EXP](π) [ × ]  0.5 [ x² ] [ ) ] [ = ]
Power Flux: 572.9577951 W/m^2

Calculating Electric Field: 
[ ( ] 1800 [ × ] 30 [ ) ] [SHIFT] (√) [ ÷ ] 0.5 [ = ]
Electric Field: 464.7580015 W/m

Calculating Magnetic Field:
[ ( ] 1800 [ ÷ ] [ ( ] 480 [ × ] [EXP](π) [ x² ] [ × ] 0.5  [ x² ] [ ) ] [ ) ] [ √ ] [ = ]
Magnetic Field: 1.232808888 A/m

Source:  Barue, Gerardo.  Microwave Engineering: Land & Space Radiocommunications John Wiley & Sons, Inc.  Hoboken, NJ  ISBN 978-0-470-08966-5 2008

Slope and Intercept with Two Points

Given two points of a line (x1, y1) and (x2, y2) we can find the slope (a) and y-intercept (b) of the general linear equation y = a*x + b.

The trick is to use the rectangular to polar conversion to find the slope:
θ = atan((y2 - y1)/(x2 -x1))
tan θ = (y2 - y1)/(x2 -x1) = slope = a

Once the slope is found, we can solve for the y-intercept:
y = a*x + b
b = y - a*x

Algorithm:
[ ( ] x1 [ - ] x2 [ ) ] [SHIFT] (R→P) [ ( ] y1 [ - ] y2 [ ) ] [ = ] [SHIFT] (X<>Y) [ tan ]
// slope is displayed

[ × ] x1* [ +/- ] [ + ] y1* [ = ]
// intercept is displayed

*x2 and y2 can be used instead

Example:
(x1, y1) = (8, 5.5)
(x2, y2) = (4, 9.5)

Result:
[ ( ] 8 [ - ] 4 [ ) ] [SHIFT] (R→P) [ ( ] 5.5 [ - ] 9.5 [ ) ] [ = ] [SHIFT] (X<>Y) [ tan ]

Slope: -1

[ × ] 8 [ +/- ] [ + ] 5.5 [ = ]

Slope: 13.5


Tomorrow will be Part II. 

Eddie

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

Thursday, June 23, 2016

Programming with the Radio Shack EC-4004

Programming with the Radio Shack EC-4004

(Another milestone: this is blog #600! I can't thank you all enough!) 

To see my retro review of this calculator I did two years ago, click here:




The Radio Shack EC-4004 calculator’s programming mode is AOS (algebraic operating system).  Rarely you see a calculator with AOS any more (think the Casio fx-260 and Texas Instruments TI-30A), but it used to be prominent operating system with RPN.   In AOS, the uniary functions (trigonometric, logarithmic, factorial, for example) are entered after you enter the number.  Hence:  14 [ln] calculates ln(14) ≈ 2.639057329.

The storage of the EC-4004 is a mere 38 steps which can be distributed into two program slots.  That is not a lot.  Furthermore, if you enter numeric constants, each digit counts a step.  Remember, the display does NOT display the key, so be careful when entering programs.  There are a few program commands:

RTN ([INV] [ 9 ]):  Returns program control the first step (beginning). 

X ≤ M ([INV] [ 8 ]):  If the display is less than or equal to M, return to the first step.  Otherwise, go to the next step.

X > 0 ([INV] [ 7 ]): If the display is greater than 0, return to the first step.  Otherwise, go to the next step.

ENT ([RUN] in learn mode):  Prompt for a number.  The next step is to put a “placeholder” number as long as it will be valid in calculations.  Since each digit counts as a step, try to use placeholder numbers like 0, 1, or 2.  I’m not sure if the placeholder number is merged with ENT.  You can instead, use Kin or Min to store the entry in memory.

HLT ([INV] [RUN]): Halts the program to display immediate results.  Think of it as the PAUSE command.

X<>K ([INV] [Kout]): Exchange with a memory register.  The EC-4004 has six memory registers, plus one additional independent memory register (M).

[Kin] and [Kout] is your store and recall, respectively.

On to the list of sample programs!  Anything after double slashes (\\) is a comment. The hashtag (#) stands for placeholder number.

Area of a Regular Polygon

Formula:  (n*s^2)/(4*tan(180°/n)), n = number of sides, s = side length

MODE,  4 \\ sets Degree mode
ENT \\ prompt for n
#  \\ enter a placeholder number
Min \\ store in M
*
ENT \\ prompt for s
#  \\ placeholder number
X^2
÷
(
4
*
(
180
÷
MR \\ recall n
)
TAN
)
=

Test 1:  n = 6, s = 2.6,  result 17.56299519
Test 2:  n = 10, s = 3.87, result 115.2353964

 Sum of f(x)

In particular, Σ x^2 + 1 from x = 1 to M.  M is the upper limit.  You can adapt this to include any f(x), but remember you’ll only have 26 steps to work with for f(x).  Your variable for f(x) is register 1 (use [Kout], 1)

Before running, store the upper limit minus 1 in M, 0 in both registers 1 and 2.  (0, [ Kin ], 1; [ Kin ], 2).  Register 1 is your counter, register 2 is your sum.   In Summary:

M = upper limit – 1, Register 1 = 0, Register 2 = 0

Kout 1  \\ recall register 1 and add one
+
1
=
Kin 1
X^2 \\ f(x) starts here
+
1
=   \\ end f(x) with equals
+   \\ add result to register 2
Kout 2
=
Kin 2
Kout 1 \\ put register 1 in the display
X≤M   \\ is X≤M? If so, go to the beginning
Kout 2 \\ display sum

Test 1:  If the upper limit is 5, store 4 in M.  Result:  60
Test 2:  If the upper limit is 8, store 7 in M.  Result:  212

Payment of a Loan (with no balloon)

Formula:  PMT = PV / ((1 – (1 + r)^-n)/r)

Store the following amounts before running:
K1 = PV, present value or loan amount
K2 = n, number of payments.  Example: For 30 years for monthly payments, store 360 in K2.
K3 = r, periodic interest rate as a decimal.  Example: For 6% compounded monthly, enter 0.06/12 in K3.


Kout 1 \\ recall PV
÷
(
(   
1
-
(
1
+
Kout 3  \\ recall r
)
X^Y
Kout 2 \\ recall n
+/-
)
÷
Kout 3
)
=


Test 1:  K1 = 200,000, K2 = 360, K3 = 0.055/12.  Result:  1,135.58
Test 2:  K1 = 234,000, K2 = 360, K3 = 0.038/12.  Result:  1,090.34

Easy Traverse Calculation

Calculates the new point knowing the original coordinates, direction, and angle of travel.  The angle 0° comes from due east and rotates counterclockwise (see diagram below). 



Store before hand:
K1 = original coordinate easting (E, x)
K2 = original coordinate northing (N, y)

Distance is stored in K3 and angle is stored K4.  At the completion of the program, the new coordinates are stored in K1 and K2, respectively, to allow chain calculations.

MODE 4 \\ degrees mode
Kout 1
+
ENT \\ prompt for distance
# \\ placeholder number
Kin 3
*
ENT \\ prompt for angle
# \\ placeholder number
Kin 4
COS
=
Kin 1
HLT \\ display new easting coordinate
Kout 2
+
Kout 3
*
Kout 4
SIN
=
Kin 2 \\ display new northing coordinate


Test:  E0 = 10,000,  N0 = 10,000
Given distance = 110, angle = 126°,  E1 ≈ 9,935.343, N1 ≈ 10,088.992
Continuing,
Given distance = 150, angle = 30°, E2 ≈ 10,065.247, N2 ≈ 10,163.992

Measuring Dew Point (in degrees Celsuis)

W = 237.3 * V/(1 – V)
V = (ln H + (17.27*C)/(237.3+C))/17.27

Where:
H = relative humidity, store as a decimal (Example:  for 55.8% store 0.558 in K1)
C = temperature in degrees Celsius

Store before hand:  H in register 1 (K1), C in register 2 (K2). 

This program illustrates a perfect example of the effect of the limited programming space.  During the calculation, 17.27 and 237.3 are stored in K3 and K4, respectively to save program space.  And believe me, we’ll need every bit of it.

Kout 1 \\ H
LN
+
17.27
Kin 3
*
Kout 2 \\ C
÷
(
237.3
Kin 4
+
Kout 2
)
=
÷
Kout 3
Min // store V in M
*
Kout 4
÷
(
1
-
MR
)
=

Remember K1 = H, K2 = C
Test 1:  H = 51% (0.51), C = 27°C, Result ≈ 16.0003°C
Test 2:  H = 46% (0.46), C = 85°F = 29.44444444°C, Result ≈ 16.6110°C

Chebyshev Polynomial of the First Kind, for -1<x<1

Formula for -1<x<1:  T_n(x) = cos(n * acos x)   (source: Wolfram, http://mathworld.wolfram.com/ChebyshevPolynomialoftheFirstKind.html, see line 44)

ENT \\ prompt for x
#  \\ placeholder number
COSˉ¹
*
ENT \\ prompt for n
#  \\ placeholder number
=
COS

Test 1:  T_2(0.25) = -0.875  (x = 0.25, n = 2)
Test 2:  T_3(-0.68) = 0.782272  (x = -0.68, n = 3)

That is a small collection of programs for the EC-4004.  If you want me to do more, let me know.  Until then, have a great day everyone and stay safe!

Eddie

This blog is property of Edward Shore, 2016



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

Access to the first set of fx-3650P 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 

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues

DM42 and HP 42S: Quadratic Equation, Characteristic Polynomial, and Eigenvalues The programs are listed for the Swiss Micros DM42 an...