Thursday, July 12, 2018

Fun with the Radio Shack EC-4026



Fun with the Radio Shack EC-4026 

(Equivalent of the Casio fx-4500P)

Programming Notes

 


The syntax for prompting for variables and displaying results are slightly different from the usual Casio programming language (as I mentioned, the EC-4026 is a clone of the fx-4500P).  Check out the unusual If-Then-Else-End structure as well. 

Prompting Syntax:
{var} : var “prompt string”

Example:
 {X}: X”ENTER X”

Display Syntax:
Calculation
“Display string”   (solid right triangle, [2ndF] [↑])

Example: 
X
“F(X)=”

The If-Then-Else-End Structure:
If condition do if the condition is true do if condition is false   (clear right triangle, [2ndF] [√])

Note:  I symbolize the [x^y] by ^.

Finding the Monthly Payment of a Mortgage with Total Interest Paid and Total Cash Outflow

Program MORTGAGE:

L1  Fix 2
L2 {A}: A”LOAN AMOUNT”
L3 {Y}: Y”YEARS”
L4 {I}: I”RATE”
L5 I = I/1200
L6 N = Y*12
L7 P = A*(I(1+I)^N)/((1+I)^N-1)
L8 “MONTHLY PMT”
L9 N*P
L10 “OUTFLOW”
L11 N*P-A
L12 “TOTAL INTEREST”
L13 Norm

Example:

A:  Loan is $250,000.00
Y:  30 years
I: Interest rate of 4%

Results:

P:  Payment:  $1,193.59
Outflow:  $429,673.77
Total Interest:  $179,673.77

Midlength, Height, and Area of a Trapezoid



Program TRAPEZIOD:

L1 {A}
L2 {B}
L3 {C}
L4 {D}
L5 H = √((-A+B+C+D)*(A-B+C+D)*(A-B+C-D)*(A-B-C+D))/(2*Abs(B-A))
L6 M = (A+B)/2
L7 K = M*H
L8 M
L9 “MIDLENGTH”
L10 H
L11 “HEIGHT”
L12 K
L13 “AREA”


Quadratic Equation A*x^2 + B*x + C = 0

Program QUAD:

L1 {A}: A”A”
L2 {B}: B”B”
L3 {C}: C”C”
L4 D = B^2-4*A*C
L5 D<0 Goto 1
L6 X = (-B + √D)/(2A)
L7 Y = (-B - √D)/(2A)
L8 Goto 0
L9 Lbl 1
L10 X = -B/(2A)
L11 “REAL”
L12 Y = √(Abs D)/(2A)
L13 “IMAG”
L14 Lbl 0
L15 “DONE”

Example:

3x^2 + 6x – 1 = 0; A = 3, B = 6, C = -1
Result:  0.154700538, -2.154700538

3x^2 + 6x + 10 = 0; A = 3, B = 6, C = 10
Result:  REAL: -1, IMAG: 1.527525232.  -1 ± 1.527525232i

Minimum Loss Matching



Variables:

Input: Y = Z0, Z = Z1

Output:

R = R1
S = R2
L = Loss Marching

Program MINLOSS:

L1 1:  “Z1<Z0”
L2 {Y}: Y”Z0”
L3 {Z}: Z”Z1”
L4 L = √(1 – Z/Y)
L5 R = Y*L: “R1”
L6 S = Z/L: “R2”
L7 L = 20 log (√(Y/Z) + √(Y/Z – 1)): “LOSS”

Example:

Input:


Y: Z0: 15
Z: Z1: 10

Output:

R1: 8.66025 Ω
R2:  17.32051 Ω
Loss:  5.71948

Add Two Polar Numbers

Polar and Rectangular conversions

Variable
Rectangular Results
Polar Results
V
x
r
W
y
θ

Program ADDPOLAR:

L1 {R}: R”R1”
L2 {S}: S”ANG1”
L3 Rec(R,S)
L4 R = V: S = W
L5 {V}: V”R2”
L6 {W}: W”ANG2”
L7 Rec(V,W)
L8 R = R+V: S = S+W
L9 Pol(R,S)
L10 V: “R SUM”
L11 W: “ANG SUM”

Example:

4 20° + 3 11 ° (In Degrees Mode)

Result (rounded to 4 digits): 6.9789 16.1442°

How to Handle a Tax Bracket (Simple Sample)

Take a sample (and simplified) tax bracket, where income is X:

0 < X ≤ 200:  tax rate is 10% of X
200 < X ≤ 600:  tax rate is 13% of X
600 < X: tax rate is 16% of X

Program:

L1 {X}: X”X”
L2 X > 600 P = 16: Goto 1
L3 X > 200 P = 13: Goto 1
L4 P = 10
L5 Lbl
L6 X * P/100


Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Sunday, July 8, 2018

Fun with the Radio Shack EC-4004

Fun with the Radio Shack EC-4004


Complex Number Multiplication

(a + bi) * (c + di) = (a*c – b*d) + (b*c + a*d)i

Store values in the following memory registers before running the program:

K1 = a
K2 = b
K3 = c
K4 = d

Output is stored in registers K5 (real part) and K6 (imaginary part).

Program:

Kout 1
*
Kout 3
-
Kout 2
*
Kout 4
=
Kin 5
HLT
Kout 2
*
Kout 3
+
Kout 1
*
Kout 4
=
Kin 6

Example:

(-8 + 3i)*(6 + 3i)   (K1 = -8, K2 = 3, K3 = 6, K4 = 3)

Result:  -57 – 6i (K5 = -57, K6 = -6)]

Product of Integers

The following program will between and b:  Product = a * (a + 1) * (a + 2) * … * b

P = Π n from n = a to b

Store values in the following memory registers before running the program:

K1 = a
M = b
K2 = 1 (store 1 in K2 each time)

Program:

Kout 1
Kin* 2
1
Kin+ 1
Kout 1
X ≤ M
Kout 2

Example:  Π n from n = 5 to 8:  P = 5 * 6 * 7 * 8

Store 5 in K1, 8 in M (Inv Min), 1 in K2. 

Heron’s Formula



The program calculates the area of the triangle.  Store the length of the sides in registers K1, K2, and K3.  The register K4 is used in the calculation and ultimately have the area.

K4 = (K1 + K2 + K3)/2

Area = (K4 * (K4 – K1) * (K4 – K2) * (K4 – K3))

Program:

Kout 1
Min
Kout 2
M+
Kout 3
M+
MR
÷
2
=
Min
Kin 4
MR
-
Kout 1
=
Kin* 4
MR
-
Kout 2
=
Kin* 4
MR
-
Kout 3
=
Kin* 4
Kout 4
Kin 4

Example:

K1 = 16.4, K2 = 13.8, K3 = 11.4

Area = 77.60164947

Catenaries



The program calculates the length of the wire in a catenary (2*s). 

Input:

K1 = Horizontal Tension
K2 = Weight of the wire (lb-ft, N, etc)
K3 = half of the distance between the poles

Program:

Kout 1
÷
Kout 2
*
(
Kout 2
*
Kout 3
÷
Kout 1
)
sinh
=
*
2
=

Example:

Input:

K1 (H) = 40N
K2 (weight) = 0.227 N
K3 (half distance between poles) = 32.6 m

Result: 65.5726 m

Source:  Chris M. Alley and Brenda M. Cornitius TI-36 Solar Guidebook Texas Instruments. 1985.

Mass Dragged on the Table by a Pulley



The program solves the following systems:

T – M1*a = μ*M1*g
T + M2*a = M2*g

Input:

K1 = mass 1 in kg
K2 = mass 2 in kg
K3 = friction of the table factor (μ)

Output:

K4 = acceleration (a) m/s^2
K5 = tension of the rope (N)

Tension is displayed first, then acceleration

SI units are assumed, where g = 9.80665 m/s^2 (Earth’s gravity constant)

Program:

9
.
8
0
6
6
5
Kin 4
*
(
Kout 2
Kin 5
-
Kout 1
Kin+ 5
*
Kout 3
)
=
÷
Kout 5
=
Kin 5
HLT
Kin- 4

Example:

K1 = 4.3 kg (mass 1)
K2 = 6.4 kg (mass 2)
K3 = 0.1 (friction μ)

Results:

T = 27.7445 N (tension, K5)
a = 5.47156 m/s^2 (acceleration, K4)

Eddie


All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Retro Review: Casio fx-450 Calculator


Retro Review:  Casio fx-450 Calculator



General Information

Company:  Casio
Type:  Solar Scientific Algebraic (postfix)
Memory:  1 (store, recall, M+)
Years:  1983 (probably produced during the 1980s with various editions)
Original Cost: Unknown, my guess is $20-$30

Casio Ledudu’s page on fx-450:  http://casio.ledudu.com/pockets.asp?type=1334&lg=eng

It’s a Folding Calculator!

The Casio fx-450 is a folding scientific calculator: one side has the normal, plastic keys with the display and solar panel.  The scientific functions are located on the other panel are touch, rubber-like keys.  The large amount of keys allows for a relatively uncrowded keyboard since the shift key only affects a few keys. 

Modes included on fx-450:

* Single Variable Statistics

* Base Conversions with Boolean conversions (BIN, OCT, HEX)

In addition, the fx-450 has fraction calculations and nine scientific constants (by pressing [MODE] [SHIFT] [1-9]).  The constants, with the exception of the speed of light, have older values (they were updated as of the 2014 CODATA) and they are:

1. Speed of Light (c)
2. Plank’s constant (h)
3. Universal gravitational constant (G)
4. Electron charge (e)
5. Mass of an electron (me)
6. Atomic mass constant (u)
7. Avogadro’s constant (Na)
8. Boltzmann constant (k)
9. Molar volume of ideal gas (Vm)

Verdict

I like the idea of a folding keyboard, especially one of this design.  However, I recommend that you take extra care of the calculator. If the calculator was shipped in bubble wrap, I would keep the bubble wrap and store the calculator.  A concern is the contacts to the scientific keys could be worn. 

The fx-450 is a multi-function scientific calculator with a great set of features and it makes a good collector’s item. 

Eddie


All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Wednesday, July 4, 2018

Fun with the HP 15C


Fun with the HP 15C

Happy Independence Day, United States!

Fractional Derivative:  kth Derivative of f(x) = x^n

This program calculates the kth derivative of x^n. The program allows for partial derivatives of x^n (where k is not an integer, such as half-integers).

Formula:

d^k/dx^k x^n = n!/(n-k)! * x^(n-k)

Input:
R0: point (x’)
R1:  n
R2: k

Program:

Step
Key
Code
001
LBL A
42, 21, 11
002
RCL 0
45, 0
003
RCL 1
45, 1
004
RCL - 2
45, 30, 2
005
y^x
14
006
LAST x
43, 36
007
x!
42, 0
008
1/x
15
009
*
20
010
RCL 1
45, 1
011
x!
42, 0
012
*
20
013
RTN
43, 32

Example:

d/dx^4 x^8  at x = 6

R0 = x’ = 6
R1 = n = 8
R2 = k = 4

Result:  2177280

d/dx^1.5 x^3.4 at x = 1

R0 = x’ = 1
R1 = n = 3.4
R2 = k = 1.5

Result:  5.5469

Sight Reduction Table

The program calculates altitude and azimuth of a given celestial body.

Inputs:

R1: Local Hour Angle (LHA), west is positive, east is negative
R2: The observer’s latitude on Earth, north is positive, south is negative (L)
R3: Declination of the celestial’s body, north is positive, south is negative (δ)

Each entry will need to be in decimal format.  If your angels are in HMS (hours-minutes-seconds) format, convert the angels to decimals by H before storing the values.

Formulas:

Altitude: 
H = asin (sin δ sin L + cos δ cos L cos LHA)

Azimuth:
Z = acos ((sin δ – sin L sin H) ÷ (cos H cos L))
If sin LHA < 0 then Z = 360° - Z

Outputs:

Altitude (in decimal), R/S, Azimuth (in decimal)

Program:

Step
Key
Code
001
LBL C
42, 21, 13
002
DEG
43, 7
003
RCL 3
45, 3
004
SIN
23
005
RCL 2
45, 2
006
SIN
23
007
*
20
008
RCL 3
45, 3
009
COS
24
010
RCL 2
45, 2
011
COS
24
012
*
20
013
RCL 1
45, 1
014
COS
24
015
*
20
016
+
40
017
ASIN
43, 23
018
STO 4
44, 4
019
R/S
31
020
SIN
23
021
RCL 2
45, 2
022
SIN
23
023
*
20
024
CHS
16
025
RCL 3
45, 3
026
SIN
23
027
+
40
028
RCL 4
45, 4
029
COS
24
030
RCL 2
45, 2
031
COS
24
032
*
20
033
÷
10
034
ACOS
43, 24
035
STO 5
44, 5
036
RCL 1
45, 1
037
SIN
23
038
TEST 2 (x<0)
43, 30, 2
039
GTO 1
22, 1
040
3
3
041
6
6
042
0
0
043
RCL - 5
45, 30, 5
044
STO 5
44, 5
045
LBL 1
42, 21, 1
046
RCL 5
45, 5
047
RTN
43, 32

Source:  “NAV 1-19A Sight Reduction Table”    HP 65 Navigation Pac.  Hewlett Packard, 1974.

Three Point Lagrangian Interpolation

This program calculates a point (x0, y0) given three known points (x1, y1), (x2, y2), and (x3, y3) where x0 is in between min(x1, x2, x3) and max(x1, x2, x3).  Ideally, x1 < x2 < x3.

Input:

R0 = x0 (on the x stack)

Store before running the program:

R1 = x1, R4 = y1
R2 = x2, R5 = y2
R3 = x3, R6 = y3

Other registers used: R7, R8, R9

Step
Key
Code
001
LBL E
42, 21, 15
002
STO 0
44, 0
003
RCL 4
45, 4
004
STO 7
44, 7
005
RCL 5
45, 5
006
STO 8
44, 8
007
RCL 6
45, 6
008
STO 9
44, 9
009
RCL 0
45, 0
010
RCL - 1
45, 30, 1
011
STO * 8
44, 20, 8
012
STO * 9
44, 20, 9
013
RCL 0
45, 0
014
RCL – 2
45, 30, 2
015
STO * 7
44, 20, 7
016
STO * 9
44, 20, 9
017
RCL 0
45, 0
018
RCL – 3
45, 30, 3
019
STO * 7
44, 20, 7
020
STO * 8
44, 20, 8
021
RCL 1
45, 1
022
RCL – 2
45, 30, 2
023
STO ÷ 7
44, 10, 7
024
CHS
16
025
STO ÷ 8
44, 10, 8
026
RCL 1
45, 1
027
RCL – 3
45, 30, 3
028
STO ÷ 7
44, 10, 7
029
STO ÷ 9
44, 10, 9
030
RCL 2
45, 2
031
RCL – 3
45, 30, 3
032
STO ÷ 8
44, 10, 8
033
STO ÷ 9
44, 10, 9
034
RCL 7
45, 7
035
RCL + 8
45, 40, 8
036
RCL + 9
45, 40, 9
037
RTN
43, 32

Example:

R1 = 5, R4 = 0.4
R2 = 10, R5 = 0.9
R3 = 15, R6 = 1.3

R0 = 12, result: 1.0720

R0 = 8, result: 0.7120

Source:  R. Woodhouse.  “Lagrangian Interpolation Routines” Datafile Summer 1984 Vol. 3 No. 3, Page 14

Quadratic Equation with Complex Coefficients

This program solves the equation where B and C are complex numbers:

x^2 + B*x + C = 0

where the roots are:

x = -B/2 ± (B^2/4 – C)

Store the following values before running:

R1 = real(B),  R2 = imag(B)
R3 = real(C), R4 = imag(C)

Output:

Root 1 (press [ f ], hold (i) for the complex part), R/S, Root 2

Program:

Step
Key
Code
001
LBL C
42, 21, 13
002
GSB 1
32, 1
003
GSB 2
32, 2
004
+
40
005
R/S
31
006
GSB 1
32, 1
007
GSB 2
32, 2
008
-
30
009
RTN
43, 32
010
LBL 1
42, 21, 1
011
RCL 1
45, 1
012
RCL 2
45, 2
013
I
42, 25
014
2
2
015
CHS
16
016
÷
10
017
RTN
43, 32
018
LBL 2
42, 21, 2
019
RCL 1
45, 1
020
RCL 2
45, 2
021
I
42, 25
022
x^2
43, 11
023
4
4
024
÷
10
025
RCL 3
45, 3
026
RCL 4
45, 4
027
I
42, 25
028
-
30
029
11
030
RTN
43, 32

Example:

x^2 + (-1 + i)*x + (3i) = 0

R1 = -1, R2 = 1
R3 = 0, R4 = 3

Results:
1.8229 – 1.8229i
-0.8229 + 0.8229i

x^2 + 3*x + (-5 + 6i) = 0

R1 = 3, R2 = 0
R3 = -5, R4 = 6

Results:
1.3862 – 1.0394i
-4.3862 + 1.0394i

Eddie

All original content copyright, © 2011-2018.  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.  Please contact the author if you have questions.

Fun with the Radio Shack EC-4026

Fun with the Radio Shack EC-4026   (Equivalent of the Casio fx-4500P) Programming Notes   The syntax for prompting ...