Showing posts with label Chebyshev polynomial. Show all posts
Showing posts with label Chebyshev polynomial. Show all posts

Sunday, December 25, 2022

HP 75C Program Collection

HP 75C Program Collection


Merry Christmas everyone!   I hope everyone is safe, happy, and blessed.



LAWCOS:  Law of Cosines

335 bytes


100 DISP "Law of Cosines" @ WAIT .25

105 OPTION ANGLE DEGREES

180 DISP "Θ is opp. side a" @ WAIT .25

110 INPUT "1) Side, 2) Angle? "; H

115 ON H GOTO 1000, 2000


1000 INPUT "b?, c?, Θ? "; B,C,T

1010 A=SQR(B^2+C^2-2*B*C*COS(T))

1020 DISP "a: "; STR$(A) @ END


2000 INPUT "a?, b?, c? "; A,B,C

2010 T=ACOS((B^2+C^2-A^2)/(2*B*C))

2020 DISP "Θ:"; STR$(T); "°" @ END


Example:

1) Side:  1

B = 11.78, C = 32.12, T = 60

Result:  a = 28.1440793063


2)  Angle: 2

A = 14.55, B = 12.65, C = 17.00

Result:  Θ = 56.5108780171°



SPECPOLY:  Special Polynomials

526 bytes  (10/27/2022)


1.Cheb:  Chebyshev Polynomial of the 1st order

2.Herm:  Hermite Polynomial 

3.Lagur:  Laguerre Polynomial (with α=0)

4.Legen:  Legendre Polynomial of the 1st Order


100 DISP "Polynomials:  Type?" @ WAIT .5

105 INPUT "1.Cheb 2.Herm 3.Lagur 4.Legen:"; H

110 INPUT "x? "; X

115 INPUT "order? ";N

120 A=1 @ B=X*(H=1 OR H=4)+2*X*(H=2)+(1-X)*(H=3)


300 IF N=0 THEN DISP A @ END

302 IF N=1 THEN DISP B @ END

305 FOR I=2 TO N

310 ON H GOSUB 500,505,510,515

315 A=B

320 B=C

325 NEXT I

330 DISP C

335 END


500 C=2*X*B-A @ RETURN

505 C=2*X*B-2*(I-1)*A @ RETURN

510 C=((2*(I-1)+1-X)*B-(I-1)*A)/I @ RETURN

515 C=((2*I-1)*X*B-(I-1)*A)/I @ RETURN


Source:


Davidson, James J.  "Chebyshev Polynomials, First & Second Kind, Tn(x) & Un(x)", "Hermite Polynomials, H(n); n≥n", "Laguerre Polynomials, Generalized, Ln^(α)(x)", "Legendre Functions, First & Second Kinds, Pn(x) & Qn(x)"  ENTER 65 NOTES  Vol. 3 No. 8 September 1976  pp. 11-12



Examples:

x = 11, order = 6

1.  Cheb:  55989361

2.  Herm: 106439224

3.  Lagur: -35.5902777778

4.  Legen: 25289461


ENGINE:  Automotive Engine Mathematics

630 bytes (10/27/2022)


100 DISP "Engine Math" @ WAIT .5

110 INPUT "# cylinders? "; N

120 DISP "Solve for?" @ WAIT .25

125 INPUT "1)DSP, 2)STROKE, 3)BORE "; H

130 IF H#1 THEN INPUT "DSP? "; D

135 IF H#2 THEN INPUT "STROKE? "; S

140 IF H#3 THEN INPUT "BORE? "; B

145 IF H=1 THEN LET D=PI/4*B^2*S*N

150 IF H=2 THEN LET S=D/(PI/4*B^2*N)

155 IF H=3 THEN LET B=SQR(D/(PI/4*S*N))

160 DISP "DPS= "; D @ STOP

165 DISP "STORKE= "; S @ STOP

170 DISP "BORE= "; B @ STOP


205 INPUT "RPM? (y/n) "; I$

210 IF UPRC(I$)="N" THEN 400


300 INPUT "RPM? "; R

310 P=S*R/6

320 E=R*D*.85/3456

350 DISP "Piston Speed="; P @ STOP

360 DISP "St. Carb CFM= "; E @ STOP

370 INPUT "Again? (y/n) "; I$ 

375 IF UPRC(I$)="Y" THEN 300


400 DISP "Done."


Source:


Lawlor, John.  Auto Math Handbook.  Calculations, Formulas, Equations, and Theory for Automotive Enthusiasts.  HP Books:  Berkeley Publishing Group:  New York, NY.  1991.  ISBN 1-55788-020-4


LINREG:  Linear Regression

568 bytes (10/31/2022)


100 DISP "y=mx+b" @ WAIT .5

110 S0=0 @ S1=0 @ S2=0 @ S3=0 @ S4=0 @ S5=0

120 DISP 'Σ+ Σ- Calc'

130 K$=KEY$ @ IF K$='' THEN 130

140 IF K$="+" THEN H=1 @ GOTO 200

150 IF K$="-" THEN H=-1 @ GOTO 200

160 IF UPRC$(K$)='C' THEN 400

170 GOTO 130


200 INPUT 'x,y? '; X,Y

210 S0=S0+H @ S1=S1+H*X @ S2=S2+H*Y

220 S3=S3+H*X^2 @ S4=S4+H*Y^2 @ S5=S5+H*X*Y

230 DISP S0 @ WAIT .5 @ GOTO 120


400 B=(S5-S1*S2/S0)/(S3-S1^2/S0)

440 A=(S2-B*S1)/S0

450 R=B*SQR((S0*S3-S1^2)/(S0*S4-S2^2))

470 DISP 'type cont...' @ WAIT .5


500 DISP 'SLP=';B @ STOP

510 DISP 'ITC=';A @ STOP

520 DISP 'CORR=';R


Instructions:

Press + to add data.  Separate  x and y with a comma.

Press - to delete data.  Separate x and y with a comma.

Press C to determine the slope, intercept, and correlation.


Example:

Data:

5, 4.066

8, 4.125

11, 4.202

18, 4.293

21, 4.349


ITC ≈ 3.99046

SLP ≈ 0.01719

CORR ≈ 0.99376


Source:


Hewlett Packard.  HP 12C User Guide  Edition 4.  San Diego, CA  2004.


SIMPSON:  Integral Using Simpson’s Rule Approximation

size varies - around 300 bytes


∫ FNF(X) dX from X = a to X = b


Line 100 is where you have to define your function (of X). 


100 DEF FNF(X) = [define f(x) here]


115 OPTION ANGLE RADIANS

120 INPUT "a? ";A

125 INPUT "b? ";B

130 INPUT "# parts (even)? ";N

135 T=FNF(A)+FNF(B)

140 H=(B-A)/N

145 FOR I TO N-1

150 IF FP(I/2)=0 THEN 155 ELSE 160

155 T=T+2*FNF(A+I*H) @ GOTO 165

160 T=T+4*FNF(A+I*H)

165 NEXT I

170 T=T*H/3

175 DISP "Integral = ";T


Examples:

For both examples, n = 24


FNF(X)= 2*X^2+3,  a = 1, b = 6, result:  158.333333333


FNF(X)=2*COS(X), a = 0, b = .785398163398, result:  1.41421357139  (exact √2)




Happy Holidays everyone!


Next post will be on New Years' Eve:  December 31, 2022.


Eddie 


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

Proving Chebyshev Polynomial Closed Formulas for n = 0, n = 1, and n = 2

Proving Chebyshev Polynomial Closed Formulas for n = 0, n = 1, and n = 2



Chebyshev Polynomials of the First Kind


Recurrence Definition:


T_0(x) = 1

T_1(x) = x

T_n+1(x) = 2 * x * T_n(x) - T_n-1(x)


Closed Definition:


T_n(x) = 1/2 * [ (x - √(x^2 - 1))^n + (x + √(x^2 - 1))^n ]


Let: w = √(x^2 - 1)


T_n(x) = 1/2 * [ (x - w)^n + (x + w)^n ]


n = 0

T_0(x) 

= 1/2 * [ (x - w)^0 + (x + w)^0 ]

= 1/2 * [ 1 + 1 ] 

= 1


n = 1

T_1(x)

= 1/2 * [ (x - w)^1 + (x + w)^1 ]

= 1/2 * [ x - w + x + w ]

= 1/2 * [ 2 * x]

= x


n = 2

T_2(x)

= 1/2 * [ (x - w)^2 + (x + w)^2 ]

= 1/2 * [ x^2 - 2*w + w^2 + x^2 + 2*w^2 + w^2 ]

= 1/2 * [ 2 * x^2 + 2 * w^2 ]

= x^2 + x^2 - 1

= 2 * x^2 - 1



Chebyshev Polynomials of the Second Kind


Recurrence Definition:


U_0(x) = 1

U_1(x) = 2 * x

U_n+1(x) = 2 * x * U_n(x) - U_n-1(x)


Closed Definition:


U_n(x) = [ (x + √(x^2 - 1))^(n + 1) - (x - √(x^2 - 1))^(n + 1) ] ÷ [ 2 * √(x^2 - 1) ]


Let: w = √(x^2 - 1)


U_n(x) = [ (x + w)^(n + 1) - (x - w)^(n + 1) ] ÷ [ 2 * w ]


n = 0

U_0(x)

= [ (x + w)^(1) - (x - w)^(1) ] ÷ [ 2 * w ]

= [ x + w - x + w ] ÷ (2 * w)

= (2 * w) ÷ (2 * w)

= 1


n = 1

U_1(x)

= [ (x + w)^(2) - (x - w)^(2) ] ÷ [ 2 * w ]

= [ (x^2 + 2 * x * w + w^2) - (x^2 - 2 * x * w + w^2) ] ÷ (2 * w)

= [ 4 * x * w ] ÷ (2 * w)

= 2 * x


n = 2

U_2(x)

= [ (x + w)^(3) - (x - w)^(3) ] ÷ [ 2 * w ]

= [ x^3 + 3*x^2*w + 3*x*w^2 + w^3 - (x^3 - 3*x^2*w + 3*x*w^2 - w^3)] ÷ [ 2*w ]

= [ x^3 + 3*x^2*w + 3*x*w^2 + w^3 - x^3 + 3*x^2*w - 3*x*w^2 + w^3] ÷ [ 2*w ]

= [ 6*x^2*w + 2*w^3 ] ÷ [ 2*w ]

= [ 6*x*√(x^2 - 1) + 2*(x^2 - 1)^(3/2) ] ÷ [ 2*√(x^2 - 1)  ]

= [ 6*x*√(x^2 - 1) + 2*(x^2 - 1)*√(x^2- 1) ] ÷ [ 2*√(x^2 - 1)  ]

= [ 6*x*√(x^2 - 1) + 2*(x^2 - 1)*√(x^2- 1) ] ÷ [ 2*√(x^2 - 1)  ]

= [ 6*x*√(x^2 - 1) + (2*x^2 - 2)*√(x^2- 1) ] ÷ [ 2*√(x^2 - 1)  ]

= [ (8*x - 2)*√(x^2 - 1) ] ÷ [ 2*√(x^2 - 1)  ]

= 4*x^2 - 1


Good that the closed formulas hold up, at least for n = 0, 1, 2.   The closed formulas would be good if you don't want to use recurrence relations.  


Sources:


"Chebyshev polynomials"  Wikipedia.   https://en.wikipedia.org/wiki/Chebyshev_polynomials  Last Updated July 20, 2022.  Last Accessed June 21, 2022


Oldman, Keith, Jan Myland, & Jerome Spainer  An Atlas of Functions: with Equator, the Atlas Function Calculator  2nd Edition   Springer:  New York, NY.  2009  ISBN 978-0-387-48806-6


Eddie


All original content copyright, © 2011-2022.  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, July 6, 2017

Fun With the HP 42S

Fun With the HP 42S

Previous Links:

HP 42S Programming Part I:  Matrix Column Sum, GCD, Error Function:  http://edspi31415.blogspot.com/2016/07/hp-42s-programming-part-i-matrix-column.html

HP 42S Programming Part II:  Dew Point, Ellipse Area and Eccentricity, Easy Transverse:
http://edspi31415.blogspot.com/2016/07/hp-42s-programming-part-ii-dew-point.html

HP 42S Programming Part III: Numerical Derivative, Recurring Sequences, Fractions:
http://edspi31415.blogspot.com/2016/07/hp-42s-programming-part-iii-numerical.html



HP 42S Julian Date

Given month, day, year, and university time (Greenwich), the Julian date is calculated.  For January 1, 2000 at 12:00 AM, the date is 2,451,545.5.

00 {141-Byte Prgm}
01 LBL “JULDATE”
02 “MONTH”
03 PROMPT
04 STO 01
05 “DAY”
06 PROMPT
07 STO 02
08 “4 DIGIT YEAR”
09 PROMPT
10 STO 03
11 “UT TIME”
12 PROMPT
13 STO 04
14 367
15 RCL* 03
16 STO 00
17 9
18 RCL+ 01
19 12
20 ÷
21 IP
22 RCL+ 03
23 4
24 ÷
25 7
26 *
27 IP
28 STO -00
29 RCL 01
30 9
31 –
32 7
33 ÷
34 RCL+ 03
35 100
36 ÷
37 IP
38 3
39 *
40 4
41 ÷
42 IP
43 STO- 00
44 275
45 RCL* 01
46 9
47 ÷
48 IP
49 STO+ 00
50 RCL 02
51 STO+ 00
52 1721028.5
53 STO+ 00
54 RCL 04
55 24
56 ÷
57 STO+ 00
58 RCL 00
59 END

Example:

Input:  May 8, 2017, 03:00 UT.  Result:  2457881.6250

HP 42S Sun Approximate Declination, Altitude, and Azimuth


Input:  Days after the vernal equinox (typically March 21), Earth’s latitude (north/south), number of hours after local noon (example:  for 7 AM, enter -5.  For 7 PM, enter 7).

00 { 147-Byte Prgm }
01 LBL “SUNAA”
02 DEG
03 “DAYS AFTER EQ.”
04 PROMPT
05 STO 00
06 “LATTITUDE”
07 PROMPT
08 STO 01
09 “HRS AFTER NOON”
10 PROMPT
11 STO 02
12 0.9856
13 RCL* 00
14 SIN
15 23.45
16 *
17 STO 04
18 COS
19 RCL 01
20 COS
21 *
22 15
23 RCL* 02
24 COS
25 *
26 RCL 01
27 SIN
28 RCL 04
29 SIN
30 *
31 +
32 ASIN
33 STO 05
34 SIN
35 RCL 01
36 SIN
37 *
38 RCL 04
39 SIN
40 –
41 RCL 05
42 COS
43 RCL 01
44 COS
45 *
46 ÷
47 ACOS
48 STO 06
49 RCL 04
50 “DECLINATION”
51 AVIEW
52 STOP
53 RCL 05
54 “ALTITUDE”
55 AVIEW
56 STOP
57 RCL 06
58 “AZIMUTH”
59 AVIEW
60 END


Example:

Input:  100 days after the vernal equinox, 43.72° N, about 12 noon (T = 0)
Results:  Declination ≈ 23.1888°, Altitude:  69.4688°, Azimuth: 0.0002°

 HP 42S Chebyshev Polynomial

The trigonometric definition is used to calculate T_n(x):

For |x| > 1, cosh (n * acosh x)
For |x| ≤ 1, cos (n * acos x)

00 {42-Byte Prgm}
01 LBL “CHEBY”
02 “N”
03 PROMPT
04 STO 00
05 “X”
06 PROMPT
07 STO 01
08 ABS
09 1
10 X≥Y?
11 GTO 00
12 RCL 01
13 ACOSH
14 RCL* 00
15 COSH
16 GTO 01
17 LBL 00
18 RCL 01
19 ACOS
20 RCL* 00
21 COS
22 LBL 01
23 END

Examples:

T_4(2) (n = 4, x = 2).  Result:  97

T_4(0.5)  (n = 4, x = 0.5)  Result:  -0.5

HP 42S Pulley

There are two weights in a pulley system, held by a rope has a negligible contribution.  The program uses SI units (kg, m, s, with g = 9.80665 m/s^2).  The simultaneous equations solve for acceleration (m/s^2) and tensions:

T – m1 * a = m1 * g
T + m2 * a = m2 * g

Source:  HP 22S Science Student Applications.  Edition 1.  Corvallis, Oregon.  May 1988

00 {161-Byte Prgm}
01 LBL “PULLEY”
02 “MASS 1 (KG)”
03 PROMPT
04 STO 01
05 “MASS 2 (KG)”
06 PROMPT
07 STO 02
08 9.80665
09 STO 00
10 2
11 ENTER
12 2
13 DIM “MAT1”
14 INDEX “MAT1”
15 1
16 STOEL
17 J+
18 RCL 01
19 +/-
20 STOEL
21 2
22 ENTER
23 1
24 STOIJ
25 1
26 STOEL
27 J+
28 RCL 02
29 STOEL
30 2
31 ENTER
32 1
33 DIM “MAT2”
34 INDEX “MAT2”
35 RCL 00
36 RCL* 01
37 STOEL
38 I+
39 RCL 00
40 RCL* 02
41 STOEL
42 RCL “MAT1”
43 INVRT
44 RCL “MAT2”
45 *
46 STO “MAT3”
47 INDEX “MAT3”
48 RCLEL
49 “T”
50 AVIEW
51 STOP
52 I+
53 RCLEL
54 “a”
55 AVIEW
56 END

Example:  m1 = 32 kg, m2 = 56 kg
Result:  tension = 399.3981, a = 2.6745 m/s^2

 HP 42S Rotation Matrix

R = [[ cos θ, -sin θ ],[ sin θ, cos θ ]]

00 {138-Byte Prgm}
01 LBL “ROTATE2”
02 DEG
03 “ANGLE °”
04 PROMPT
05 STO 00
06 1
07 ENTER
08 2
09 DIM “MAT1”
10 INDEX “MAT1”
11 “X0”
12 PROMPT
13 STOEL
14 J+
15 “Y0”
16 PROMPT
17 STOEL
18 2
19 ENTER
20 2
21 DIM “MAT2”
22 INDEX “MAT2”
23 RCL 00
24 COS
25 STOEL
26 J+
27 RCL 00
28 SIN
29 +/-
30 STOEL
31 2
32 ENTER
33 1
34 STOIJ
35 RCL 00
36 SIN
37 STOEL
38 J+
39 RCL 00
40 COS
41 STOEL
42 RCL “MAT1”
43 RCL “MAT2”
44 *
45 STO “MAT3”
46 INDEX “MAT3”
47 RCLEL
48 “X1”
49 AVIEW
50 STOP
51 J+
52 RCLEL
53 “Y1”
54 AVIEW
55 END

Example:
Input:  [3, -2], at an angle θ = 40°
Result:  [ 1.0126, -3.4605 ]

 Always fun working with the classic HP 42S!

Eddie

This blog is property of Edward Shore



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



Sharp EL-5200/EL-9000 AER II Program Collection – September 2026

Sharp EL-5200/EL-9000 AER II Program Collection – September 2026 For my review on the Sharp EL-5200 (also known as the Sharp EL-9000)...