HP Forums
(15C) Three Linear Equations in Three Unknowns - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: General Software Library (/forum-13.html)
+--- Thread: (15C) Three Linear Equations in Three Unknowns (/thread-11926.html)



(15C) Three Linear Equations in Three Unknowns - Gamo - 12-09-2018 12:43 PM

This program solve for Simultaneous Equation in Three Unknowns.

Formula used Cramer’s Rule for a 3×3 System (with Three Variables)

Equations:

a1(X) + b1(Y) + c1(Z) = d1
a2(X) + b2(Y) + c2(Z) = d2
a3(X) + b3(Y) + c3(Z) = d3

------------------------------------
Procedure:

[E] Initialize Display 0.000000000 briefly then 0.0000

a1 [ENTER] a2 [ENTER] a3 [R/S]
b1 [ENTER] b2 [ENTER] b3 [R/S]
c1 [ENTER] c2 [ENTER] c3 [R/S]
d1 [ENTER] d2 [ENTER] d3 [R/S]

[D] Answer Determinant // If 0 "No Solution"
[A] Answer X
[B] Answer Y
[C] Answer Z

--------------------------------------
Example:

x - 8y + z = 4
-x + 2y + z = 2
x - y + 2z = -1

[E] 0.000000000 briefly then 0.00 // Initialize

1 [ENTER] 1 [CHS] [ENTER] 1 [R/S] display 1
8 [CHS] [ENTER] 2 [ENTER] 1 [CHS] [R/S] display -8
1 [ENTER] 1 [ENTER] 2 [R/S] display 1
4 [ENTER] 2 [ENTER] 1 [CHS] [R/S] display 4

[D] display -20.0000 // Determinant
[A] display -3.0000 // Answer X
[B] display -0.8000 // Answer Y
[C] display 0.6000 // Answer Z

------------------------------------------------------
Program:

Set Memory Reallocation as needed by this program.

13 f [DIM] [(i)]

Check to see require Memory Usage have set correctly

Press g then press and hold [MEM] display 13 14 24-4

Code:

LBL E   // Initialize and Store Elements
REG
CLx
FIX 9 
PSE
FIX 4
R/S
STO 3
Rv
STO 2
Rv
STO 1
R/S
STO 6
Rv
STO 5
Rv
STO 4
R/S
STO 9
Rv
STO 8
Rv
STO 7
R/S
STO .3
Rv
STO .2
Rv
STO .1
RTN
----------------------------
LBL D   // Determinant
RCL 5
RCL 9
  x
RCL 8
RCL 6
  x
  -
RCL 1
  x
RCL 2
RCL 9
  x
RCL 8
RCL 3
  x
  -
RCL 4
  x
  -
RCL 2
RCL 6
  x
RCL 5
RCL 3
  x
  -
RCL 7
  x
  +
STO 0  
---------------------------
LBL A   // Find X
RCL 5
RCL 9
  x
RCL 8
RCL 6
  x
  -
RCL .1
  x
RCL .2
RCL 9
  x
RCL 8
RCL .3
  x
  -
RCL 4
  x
  -
RCL .2
RCL 6
  x
RCL 5
RCL .3
  x
  -
RCL 7
  x
  +
RCL 0
  ÷
RTN
----------------------------
LBL B   // Find Y
RCL .2
RCL 9
  x
RCL 8
RCL .3
  x
  -
RCL 1
  x
RCL 2
RCL 9
  x
RCL 8
RCL 3
  x
  -
RCL .1
  x
  -
RCL 2
RCL .3
  x
RCL .2
RCL 3
  x
  -
RCL 7
  x
  +
RCL 0
  ÷
RTN
-------------------------
LBL C   // Find Z
RCL 5
RCL .3
  x
RCL .2
RCL 6
  x
  -
RCL 1
  x
RCL 2
RCL .3
  x
RCL .2
RCL 3
  x
  -
RCL 4
  x
  -
RCL 2
RCL 6
   x
RCL 5
RCL 3
  x
  -
RCL .1
  x
  +
RCL 0
  ÷
RTN

Gamo


RE: (15C) Three Linear Equations in Three Unknowns - Gamo - 12-12-2018 05:24 AM

Using the build-in Matrix features this program help reduce the setup steps
to solve for the 3x3 Matrix of Three Equations in Three Unknown.

-------------------------------------

Procedure: ** (USER mode) **

[D] Input each elements follow by [R/S] from left to right to each three rows.
[E] Input each elements follow by [R/S] from top to bottom the last columns.

When done display show [ c 3 1 ]

[R/S] Answer for X
[R/S] Answer for Y
[R/S] Answer for Z
--------------------------------------------------
Example: FIX 4 [USER]

x - 8y + z = 4
-x + 2y + z = 2
x - y + 2z = -1

[D] display 3.0000

1 [R/S] 8 [CHS] [R/S] 1 [R/S]
1 [CHS] [R/S] 2 [R/S] 1 [R/S]
1 [R/S] 1 [CHS] [R/S] 2 [R/S] display 2

[E] display 1.0000

4 [R/S] 2 [R/S] 1 [CHS] [R/S] display [c 3 1 ]

[R/S] display -3.0000 // X
[R/S] display -0.8000 // Y
[R/S] display 0.6000 // Z

--------------------------------------------
Program: ****[ USER mode ]****
Code:

LBL D
MATRIX 0
MATRIX 1
3
ENTER
DIM A
R/S
LBL 1
STO A
CLx
R/S
GTO 1
-----------------------------
LBL E

ENTER
1
DIM B
R/S
STO B
R/S
STO B
R/S
STO B
RESULT C
RCL MATRIX B
RCL MATRIX A
÷
R/S
RCL C
R/S
RCL C
R/S
RCL C
RTN

Remark:

If user like to know the Determinant of this 3x3 Matrix

RCL MATRIX A
MATRIX 9

Gamo


RE: (15C) Three Linear Equations in Three Unknowns - Jlouis - 02-02-2019 10:39 PM

Thanks, really nice