Showing posts with label 2 x 2 systems. Show all posts
Showing posts with label 2 x 2 systems. Show all posts

Saturday, April 20, 2024

Sharp EL-9300 Programs

Sharp EL-9300 Programs


Today’s blog entry takes us to the 1992 Sharp’s EL-9300 graphing calculator. On January 10, 2022, I gave a review of this calculator:

https://edspi31415.blogspot.com/2022/01/retro-review-sharp-el-9300c.html



The programs should also work on the EL-9200. Spaces are added for readability.



Sharp EL-9300 Program: polygon2


The program polygon2 calculates four properties of regular polygons:

* The internal angle of the polygon

* The length of the polygon’s apothem

* The length of the polygon’s radius

* The area of the polygon


A regular polygon is a polygon whose sides all have equal length and all the internal angles are equal.


REAL Mode

Print “Set Degrees 1st”

Wait 1

Print “number of sides”

Input n

Print “side length”

Input x

angle = (n – 2) / n * 180

apothem = x / 2 * tan (angle / 2)

radius = x / (2 * cos (angle / 2) )

area = n * x * apothem / 2

ClrT

Print angle

Print apothem

Print radius

Print area



Note that the calculator must be set in Degrees mode prior to running this program. To set the degrees mode, press [ SET UP ], [ B ], [ 1 ]. Note that this won’t set the angle mode indicator in the program as the angle mode change takes place outside of the program script.


Examples


Inputs: n = 6, x = 8

Outputs:

angle = 120 (internal angle)

apothem = 6.92820323

radius = 8

area = 166.2768775



Inputs: n = 12, x = 1.5

Outputs:

area = 150

apothem = 2.799038106

radius = 2.897777479

area = 25.19134295



Sharp EL-9300 Program: agm


The program agm calculates the arithmetic-geometric mean between two numbers x and y.


(x + y) / 2

√(x * y)


The program also asks for the tolerance. If the tolerance is small, it means we are asking for better accuracy at the expense of additional calculations.


REAL Mode

ClrT

Print “arithmetic/”

Print “geometric mean”

Input x

Input y

Print “tol (10^-nn)”

Input tol

Label loop

a = (x + y) / 2

g = √(x * y)

x = a

y = g

If abs(a – g) >= tol Goto loop

ClrT

Print “results”

Print a

Print g

End


Examples


Inputs: x = 15, y = 70, tol = 10^-6

Outputs:

a = 37.28076573

g = 37.28076573


Inputs: x = 1649, y = 1248, tol = 1E-7

Outputs:

a = 1441.519759

g = 1441.519759


The EL-9300 is pretty quick.



Sharp EL-9300: quadratic


The program quadratic solves the quadratic equation:


a * x^2 + b * x + c = 0


where a, b, and c can be real or complex numbers.


COMPLEX Mode

ClrT

Print “ax^2+bx+c=0”

Print “complex numbers”

Input a

Input b

Input c

x = (-b + √(b^2 – 4 * a * c)) / (2 * a)

z = x - √(b^2 – 4 * a * c) / a

ClrT

Print “solutions=”

Print x

Print z

End


Examples


Inputs:

a = 4 + 3i, b = 2 – 5i, c = 3i

Solutions:

x = 0.346818295 – 0.288439118i

z = -0.066818295 + 1.328439118i


Inputs:

a = 2, b = -6i, c = -4 + 8i

Solutions:

x = 1.370730624 + 0.040924113i

z = -1.370730624 + 2.959075887i



Sharp EL-9300 Program: twobytwo


The program twobytwo solves the simultaneous set of equations:


a * x + b * y = e

c * x + d * y = f


where a, b, c, d, e, and f can be complex numbers.


COMPLEX Mode

Print “2x2 system”

Print “complex numbers”

Print “A=((a,b)(c,d))”

Input a

Input b

Input c

Input d

Print “B=((e)(f))”

Input e

Input f

g = a * d – b * c

h = e * d – f * b

i = a * f – c * e

x = h / g

y = i / g

ClrT

Print “solutions=”

Print x

Print y

End



Examples


Input:

a = 3 + 2i, b = -i

c = 3 – 2i, d = 1 – i

e = 0, f = 5i

Outputs:

x = -0.660377358 + 0.188679245i

y = -0.754716981 + 2.358490566i


Input:

a = 3, b = -6

c = 3i, d = 6i

e = 1, f = -i

Outputs:

x = 0

y = -0.166666667




Eddie


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


Monday, July 4, 2016

TI-65 Programs Part III: Impedance and Phase Angle of a Series RLC Circuit, 2 x 2 Linear System Solution, Prime Factorization (from TI-65 Manual)

TI-65 Programs Part III:  Impedance and Phase Angle of a Series RLC Circuit, 2 x 2 Linear System Solution, Prime Factorization (from TI-65 Manual)


This is the third and final part of programs I will post today, this Fourth of July.




TI-65 Impedance and Phase Angle of a Series RLC Circuit

Formulas:

Impedance: Z = √(R^2 + (XL –XC)^2)

Phase Angle:  Φ = atan ((XL – XC)/R)

Where:
R = resistance of the resistor in ohms (Ω)
L = inductance of the inductor in Henrys (H)
C = capacitance of the capacitor in Farads (F)
f = resonance frequency in Hertz (Hz)
XL = 2*π*f*L
XC = 1/(2*π*f*C)

Program:
CODE
STEP
KEY
COMMENT
38
00
*
Start with f
2
01
2

38
02
*

2nd 17
03
π

39
04
=
Calculate 2*π*f
12.0
05
STO 0

12.1
06
STO 1

38
07
*

51
08
R/S
Prompt for L
39
09
=

12.0
10
STO 0
Calculate XL
13.1
11
RCL 1

38
12
*

51
13
R/S
Prompt for C
39
14
=

34
15
1/x

12.1
16
STO 1
Calculate XC
51
17
R/S
Prompt for R
12.2
18
STO 2

2nd 33
19
x^2

59
20
+

16
21
(

13.0
22
RCL 0

49
23
-

13.1
24
RCL 1

17
25
)

2nd 33
26
x^2

39
27
=

33
28
√

-2nd 16
29
INV 2nd ENG
Remove ENG Notation
51
30
R/S
Display Z
16
31
(

13.0
32
RCL 0

49
33
-

13.1
34
RCL 1

17
35
)

28
36
÷

13.2
37
RCL 2

39
38
=

-24
39
INV TAN
arctangent
51
40
R/S
Display Φ

Input:  f [RST] [R/S], L [R/S], C [R/S], R [R/S]
Result:  Z [R/S] Φ

Test: f = 60 Hz, L = 0.25 H, C = 16 * 10^-6 F, R = 150 Ω
Result (in degrees mode):  Z ≈ 166.18600 Ω,  Φ ≈ -25.49760°

Source:  Browne Ph. D, Michael.  “Schaum’s Outlines:  Physics for Engineering and Science”  2nd Ed.  McGraw Hill: New York, 2010


TI-65 2 x 2 Linear System Solution

Let M = [ [a, b], [c, d] ],  S =  [ [ f ], [ g ] ]

Determinant:  E = a*d – b*c

If E ≠ 0, the solutions to the system Mx = S:
x1 = d/E * f – b/E * g
x2 = -c/E * f + a/E * g

Memory Registers:
R0 = a
R1 = b
R2 = c
R3 = d
R4 = f
R5 = g

Hence [ [R0, R1], [R2, R3] ] * [ [x1], [x2] ] = [ [R4], [R5] ].  The determinant is stored in R6.  Since so many storage registers are used, and storage registers eat up programming memory, the program will need to be short.

Program:
CODE
STEP
KEY
COMMENT
13.0
00
RCL 0
Calculate det(M)
38
01
*

13.3
02
RCL 3

49
03
-

13.1
04
RCL 1

38
05
*

13.2
06
RCL 2

39
07
=

12.6
08
STO 6

13.3
09
RCL 3
Calculate x1
38
10
*

13.4
11
RCL 4

49
12
-

13.1
13
RCL 1

38
14
*

13.5
15
RCL 5

39
16
=

28
17
÷

13.6
18
RCL 6

39
19
=

51
20
R/S
Display x1
13.0
21
RCL 0
Calculate x2
38
22
*

13.5
23
RCL 5

49
24
-

13.2
25
RCL 2

38
26
*

13.4
27
RCL 4

39
28
=

28
29
÷

13.6
30
RCL 6

39
31
=

51
32
R/S
Display x2


Input:
Store values:
a [STO] 0, b [STO] 1, c [STO] 2, d [STO] 3; f [STO] 4, g [STO] 5
Press [RST] [R/S]
If det(M) ≠ 0, x1 will be calculated.  Press [R/S] to get x2.
Press [RCL] 6 to get the determinant of M.

Test:  Solve
2*x1 + 3*x2 = 3.45
-6*x1 + x2 = 4.26

R0 = 2, R1 = 3, R2 = -6, R3 = 1, R4 = 3.45, R5 = 4.26

Results:  x1 = -0.4665, x2 = 1.461.    Determinant = 20 (stored in R6)


TI-65 Prime Factorization

This prime factorization comes straight from the Texas Instruments TI-65 Manual.

Program:
CODE
STEP
KEY
COMMENT
12.1
00
STO 1
Store n in R1
0
01
0

12.0
02
STO 0
Store 0 for comparisons
3
03
3

12.2
04
STO 2
Trail factor of 3
2nd 53.0
05
LBL 0
Test 2 as a factor
13.1
06
RCL 1

28
07
÷

2
08
2

39
09
=

2nd 28
10
FRAC
Is frac(R1/2)≠0?
-3rd 43
11
INV x=m
x≠m
0
12
0
R1≠R0?
2nd 54.1
13
GTO 1
Go to odd factors
2
14
2

12.28
15
STO÷

1
16
1
STO÷ 1
51
17
R/S
Display 2 if it is a factor
2nd 54.0
18
GTO 0
GTO 0, test 2 again
2nd 53.1
19
LBL 1
Odd factors loop begins here
13.1
20
RCL 1

-3rd 42
21
INV x<m
x≥m
2
22
2
Is R1≥R2?
2nd 54.2
23
GTO 2
All factors found? No: GTO LBL 2
13.1
24
RCL 1
If complete, display 1
51
25
R/S
(program execution ends here)
2nd 54.1
26
GTO 1

2nd 53.2
27
LBL 2
Label 2 starts here
13.1
28
RCL 1

28
29
÷

13.2
30
RCL 2

39
31
=

2nd 28
32
FRAC
Is frac(R1/R2)≠0?
-3rd 43
33
INV 3rd x=m
x≠m
0
34
0

2nd 54.3
35
GTO 3

13.2
36
RCL 2
Display odd factor
51
37
R/S

12.28
38
STO÷

1
39
1
STO÷ 1
2nd 54.1
40
GTO 1

2nd 53.3
41
LBL 3
Test next odd factor
2
42
2

12.59
43
STO+

2
44
2
STO+ 2
2nd 54.1
45
GTO 1


Input:  Enter n, press [RST] [R/S].  Each prime factor is displayed, keep on pressing [R/S] until you get 1 displayed.

Test 1:  Factorize 102
Input:  102 [RST] [R/S]
Result: 2, press [R/S]
Result: 3, press [R/S]
Result: 17, press [R/S]
Result: 1
Final result:  102 = 2 * 3 * 17

Test 2:  Factorize 168
Input: 168 [RST] [R/S]
Repeated presses of [R/S] gives: 2, 2, 2, 3, 7, 1
Final result:  168 = 2 * 2 * 2 * 3 * 7 = 2^3 * 3 * 7

Resource:  Texas Instruments.  “Texas Instruments Professional TI-65 Guidebook”  1986

This blog is property of Edward Shore, 2016.


TI-84 Evo Basic: Half-Wave Dipole Antenna Length

TI-84 Evo Basic: Half-Wave Dipole Antenna Length Introduction The length of a half-wave antenna is calculated by: L = λ / 2 =...