Showing posts with label linear system. Show all posts
Showing posts with label linear system. 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.


Saturday, March 2, 2024

Spotlight: Casio fx-95 US Equation

Spotlight: Casio fx-95 US Equation



Welcome to another retro review.


Quick Facts


Model: fx-95US Equation

Company: Casio

Timeline: unknown, I’m guessing the 1980s

Type: Scientific Calculator

Number of Digits: 10

Power: 2 AA batteries (per manual)


There are also two variations of the fx-95US Equation:


fx-95 Equation

fx-500


The fx-95 US Equation and fx-95 Equation have a flip hard case, while the fx-500 does not. For the purposes of replacing the battery, I would have preferred the fx-500 case. The fx-500 requires two LR44 batteries.








Three Equation Modes


The fx-95 US Equation (and fx-500) is a basic, 10-digit scientific calculator with fractions. You have basic set of functions, including trigonometry, hyperbolic functions, random numbers, powers, roots, logarithms, and basic one-variable statistics.


The main attraction is the three equation modes:


MODE 1: QUAD (quadratic equation – real numbers only)

MODE 2: SIMUL-2 (2 x 2 linear system)

MODE 3: SIMUL-3 (3 x 3 linear system)


Entering coefficients and viewing answers happen by pressing the [ M+ ] key.


The fx-95 US does not allow for complex number solutions.


Examples:


x^2 + 5 × x + 6 = 0


Solutions: X 1: -2; X 2: -3


x^2 + 16 × x + 64 = 0


Solutions: x: -8 (repeated root)


-x^2 + 3 × x – 9 = 0


Solutions: 1: - E - (complex roots)



-2x + 3y = 5

x + 17y = 48


a1: -2, b1: 3, c1: 5

a2: 1, b2: 17, c2: 48


Solutions: X: 1.59459, Y: 2.72973


-x + z = 5

-2x – y – z = -3

3x + y – 2z = 1


a1: -1, b1: 0, c1: 1, d1: 5

a2: -2, b2: -1, c2: -1, d2: -3

a3: 3, b3: 1, c3: -2, d3: 1


Solutions: X: -6 ½, Y: 17 ½, Z: -1 ½


Check the left side as it will display the variable you are working with.




fx-95 US Equation vs. fx-260 Solar (II)






Comparison of Modes


Mode . (decimal point): SD

Mode 0: COMP

Mode 1: QUAD (fx-95 US Equation only)

Mode 2: SIMUL-2 (fx-95 US Equation only)

Mode 3: SIMUL-3 (fx-95 US Equation only)

Mode 4: DEG (SHIFT MODE 4 to convert to degrees, fx-260 Solar only)

Mode 5: RAD (SHIFT MODE 5 to convert to radians, fx-260 Solar only)

Mode 6: GRA (SHIFT MODE 6 to convert to grads, fx-260 Solar only)

Mode 7: FIX

Mode 8: SCI

Mode 9: NORM


The fx-260 adds the following functions: x^3, nCr, nPr.



The availability of the Casio fx-95US EQUATION is fairly good.



Source


Casio Computer Co, Ltd. fx-95, fx-500 Manual. Manual available on manualslib.com. https://www.manualslib.com/manual/358116/Casio-Fx-500.html#manual Retrieved January 20, 2024


Casio Ledudu. “CASIO fx-95US EQUATION” https://casio.ledudu.com/pockets.asp?type=1239&lg=eng


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.


Saturday, November 9, 2019

HP 35S: Determinant and Cramers Rule - 3 x 3 Matrices

HP 35S: Determinant and Cramers Rule - 3 x 3 Matrices

Determinant of a 3 x 3 Matrix

The following program calculates a determinant of a matrix:

[ [ K, N, Q ]
[ L, O, R ]
[ M, P, S ] ]

The determinant is  K*O*S + N*R*M + Q*L*P - M*O*Q - P*R*K - S*L*N.

Enter the elements in columns. 

Program HP 35S:  Determinant

D001 LBL D
D002 SF 10
D003 "DET 3x3"
D004 CF 10
D005 INPUT K
D006 INPUT L
D007 INPUT M
D008 INPUT N
D009 INPUT O
D010 INPUT P
D011 INPUT Q
D012 INPUT R
D013 INPUT S
D014 RCL K
D015 RCL* O
D016 RCL* S
D017 RCL N
D018 RCL* R
D019 RCL* M
D020 +
D021 RCL Q
D022 RCL* L
D023 RCL* P
D024 +
D025 RCL M
D026 RCL* O
D027 RCL* Q
D028 -
D029 RCL P
D030 RCL* R
D031 RCL* K
D032 -
D033 RCL S
D034 RCL* L
D035 RCL* N
D036 -
D037 RTN

Examples:

[ [ -3, 3, 2 ]
[ 5, 4, -1 ]
[ 2, 1, 4 ] ]
Determinant:  -123

[ [ 5, 0, 7 ]
[ -2, 4, -1 ]
[ -3, 11, 6 ] ]
Determinant:  105

Cramer's Rule

Cramer's Rule solves the linear system:

[[ A, D, G ]   [[ x ]  = [[ X ]
[ B, E, H ]     [ y ]  = [ Y ]
[ C, F, I ]]      [ z ]] = [ Z ]]

x = U, y = V, z = W,  T = determinant of the coefficients

Program HP 35S: Cramer's Rule

C001 LBL C
C002 GTO C027
C003 RCL K     // determinant calculation
C004 RCL* O
C005 RCL* S
C006 RCL N
C007 RCL* R
C008 RCL* M
C009 +
C010 RCL Q
C011 RCL* L
C012 RCL* P
C013 +
C014 RCL M
C015 RCL* O
C016 RCL* Q
C017 -
C018 RCL P
C019 RCL* R
C020 RCL* K
C021 - 
C022 RCL S
C023 RCL* L
C024 RCL* N
C025 - 
C026 RTN
C027 SF10  // input numbers into the system
C028 "COL 1"
C029 INPUT A
C030 STO K
C031 INPUT B
C032 STO L
C033 INPUT C
C034 STO M
C035 "COL 2"
C036 INPUT D
C037 STO N
C038 INPUT E
C039 STO O
C040 INPUT F
C041 STO P
C042 "COL 3"
C043 INPUT G
C044 STO Q
C045 INPUT H
C046 STO R
C047 INPUT I
C048 STO S
C049 "VECTOR" 
C050 INPUT X
C051 INPUT Y
C052 INPUT Z
C053 XEQ C003
C054 STO T
C055 "DET="
C056 VIEW T
C057 RCL X
C058 STO K
C059 RCL Y
C060 STO L
C061 RCL Z
C062 STO M
C063 XEQ C003
C064 RCL÷ T
C065 STO U
C066 "X="
C067 STOP
C068 RCL A
C069 STO K
C070 RCL B
C071 STO L
C072 RCL C
C073 STO M
C074 RCL X
C075 STO N
C076 RCL Y
C077 STO O
C078 RCL Z
C079 STO P
C080 XEQ C003
C081 RCL÷ T
C082 STO V
C083 "Y="
C084 STOP
C085 RCL D
C086 STO N
C087 RCL E
C088 STO O
C089 RCL F
C090 STO P
C091 RCL X
C092 STO Q
C093 RCL Y
C094 STO R
C095 RCL Z
C096 STO S
C097 XEQ C003
C098 RCL÷ T
C099 STO W
C100 "Z="
C101 CF 10
C102 TOP
C103 RTN

Examples:

[[ -3, 2, -4 ]   [[ x ]  = [[ 0 ]
[ 6, 1, 2 ]       [ y ]  = [ 2 ]
[ 3, 3, 7 ]]      [ z ]] = [ 6 ]]
T:  -135
x ≈ 0.0296
y ≈ 0.9333
z ≈ 0.4444

[[ 0, 10, 6 ]  [[ x ] = [[ 3 ]
[ 5, 3, 8 ]     [ y ]  = [ 6.5 ]
[ -5, 8, 2 ]]    [ z ]] = [ 7 ]]
T:  -830
x ≈ -0.0843
y ≈ 0.6687
z ≈ 0.6145

Source:

Pike, Scott.  "Using Cramer's Rule to Solve Three Equations with Three Unknowns"  Mesa Community College.  http://www.mesacc.edu/~scotz47781/mat150/notes/cramers_rule/Cramers_Rule_3_by_3_Notes.pdf  Retrieved September 24, 2019

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.

Wednesday, August 8, 2018

HP 35S: Intersection Point of a Quadrilateral


HP 35S: Intersection Point of a Quadrilateral

Introduction

Let A, B, C, and D be four vertices of a quadrilateral, with two lines:

Line AC connects points A and C.
Line BC connects points B and D.



Designate the following points as:

A:  (ax, ay)
B:  (bx, by)
C:  (cx, cy)
D:  (dx, dy)

The center point (px, py) can be found by the following formulas:

px = (IBD – IAC)/(SAC – SBD)
py = SAC * px + IAC

Where:

Slope:
SAC = (cy – ay) / (cx – ax)
SBD = (dy – by) / (dx – bx)

Intercept:
IAC = ay – SAC * ax
IBD = by – SBD * bx

You can see the derivation of these formulas here:  https://edspi31415.blogspot.com/2017/08/geometry-intersection-point-of.html

Program  (Pedro Daniel Leiva)

The following program calculates the point – developed by Pedro Daniel Leiva. I used the recall arithmetic available on the HP 35S to shorten the program.  Program listed here with permission. 

Variables Used:

R_A = ax
R_B = ay
R_C = bx
R_D = by
R_E = cx
R_F = cy
R_G = dx
R_H = dy
R_I = SAC
R_J = SBD
R_K = IAC
R_L = IBD
R_P = px
R_Y = py

Program:

I001 LBL I
I002 SF 10
I003 ENTER XA^YA  \\ EQN
I004 STO B
I005 x<>y
I006 STO A
I007 ENTER XB^YB  \\ EQN
I008 STO D
I009 x<>y
I010 STO C
I011 ENTER XC^YC \\ EQN
I012 STO F
I013 x<>y
I014 STO E
I015 ENTER XD^YD  \\ EQN
I016 STO H
I017 x<>y
I018 STO G
I019 CF 10
I020 RCL F
I021 RCL - B     \\ [RCL] [ - ] ( B )
I022 RCL E
I023 RCL - A  \\ [RCL] [ - ]  ( A ) 
I024 ÷
I025 STO I
I026 STO P  \\ advanced storage to calculate px to save steps
I027 RCL× A
I028 +/-
I029 RCL+ B
I030 STO K
I031 RCL H
I032 RCL - D
I033 RCL G
I034 RCL – C
I035 ÷
I036 STO J
I037 STO – P
I038 RCL × C
I039 +/-
I040 RCL + D
I041 STO L
I042 RCL – K
I043 RCL ÷ P
I044 STO P
I045 ENTER
I046 RCL × I
I047 RCL + K
I048 STO Y
I049 x<>y
I050 RTN

50 steps

Instructions:

At each prompt, enter the x point, press [ENTER], enter the y point, press [ R/S ].  The result shows py on the Y stack, and px on the X stack.

Example:

A:  (0, 8)
B:  (11, 12)
C:  (10, 4)
D:  (3, 5)

Results:

py = 6.2353
px = 4.4118

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, August 13, 2017

Casio fx-3650p and HP 21S: The Intersection Point of a Quadrilateral

Casio fx-3650p and HP 21S: The Intersection Point of a Quadrilateral

Introduction

This program calculates the coordinates of the center of quadrilateral.  For the derivation, please see this link:  http://edspi31415.blogspot.com/2017/08/geometry-intersection-point-of.html


Casio fx-3650P

See the diagram below. 



Due to the lack of variable available, 7, the program asks for A, B, C, and D twice.  Most of my programs asks for the inputs, then executes calculations.  This program asks for some inputs, does some calculations, then asks for more input, then executes calculations, including replacing variables to make room for further calculations. 

Program (91 steps):

? → A : ? → B : ? → C : ? → D :
(D – B) ÷ (C – A → X :
B – A X → Y :
? → A : ? → B : ? → C : ? → D :
(D – B) ÷ (C – A → C :
B – A C → D :
(D – Y) ÷ (X – C → X ◢
D + C X → Y

HP 21S

See the diagram below.  Input the following points into R0 through R7.



Program (the code and steps should be the same for the HP 20S):

Step
Code
Key
01
61, 41, A
LBL A
02
33
(
03
22, 3
RCL 3
04
65
-
05
22, 1
RCL 1
06
34
)
07
45
÷
08
33
(
09
22, 2
RCL 2
10
65
-
11
22, 0
RCL 0
12
74
=
13
21, 8
RCL 8
14
55
*
15
22, 0
RCL 0
16
32
+/-
17
75
+
18
22, 1
RCL 1
19
74
=
20
21, 0
STO 9
21
33
(
22
22, 7
RCL 7
23
65
-
24
22, 5
RCL 5
25
34
)
26
45
÷
27
33
(
28
22, 6
RCL 6
29
65
-
30
22, 4
RCL 4
31
34
)
32
74
=
33
21, 6
STO 6
34
55
*
35
22, 4
RCL 4
36
32
+/-
37
75
+
38
22, 5
RCL 5
39
74
=
40
21, 7
STO 7
41
33
(
42
22, 7
RCL 7
43
65
-
44
22, 9
RCL 9
45
34
)
46
45
÷
47
33
(
48
22, 8
RCL 8
49
65
-
50
22, 6
RCL 6
51
74
=
52
21, 8
STO 8
53
26
R/S
54
55
*
55
22, 6
RCL 6
56
75
+
57
22, 7
RCL 7
58
74
=
59
21, 9
STO 9
60
61, 26
RTN


Variables – HP 21S: 

Register
Input
Output
R0
A1

R1
B1

R2
C1

R3
D1

R4
A2

R5
B2

R6
C2
C’
R7
D2
D’
R8

X
R9

Y

Example



From top-left hand corner clockwise:  (-1, 4), (4, 6), (5, -1), (0, 0)

Results:
X = 1.357142857
Y = 2.035714286

Eddie


This blog is property of Edward Shore, 2017.

Python: Drawing a Ring of Circles

Python: Drawing a Ring of Circles The goal: Draw a number of circles that revolve around the origin (0,0). The center of each circle i...