Post Reply 
(12C Platinum) Two Linear Equations in Two Unknowns
11-28-2018, 08:15 AM
Post: #1
(12C Platinum) Two Linear Equations in Two Unknowns
Here is my first attempt to program in ALG mode.

This program solve for Simultaneous Equation in Two Unknowns.

-----------------------------------------------
Formula using Cramer's Rule

Equations:

Ax + By = e
Cx + Dy = f

If AD - BC = 0 there is No Solution.

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

Procedure:

Input: A [R/S] B [R/S] e [R/S] C [R/S] D [R/S] f [R/S] [R/S]
Display: X [R/S] Y

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

Example:

2X - Y = 15
X + 2Y = 30

2 [R/S] 1 [CHS] [R/S] 15 [R/S]
1 [R/S] 2 [R/S] 30 [R/S] [R/S] display 12 [R/S] 9

Answer: X=12 and Y=9

-------------------------------------------
X + Y = -1
2X + 2Y = -2

1 [R/S] 1 [R/S] 1 [CHS] [R/S]
2 [R/S] 2 [R/S] 2 [CHS] [R/S] [R/S] Display 0.000000000 briefly then 0.00

Answer: No Solution

-------------------------------------------
Program: Linear Equation in Two Unknowns (ALG Mode)
Code:

001 STO 1
002 R/S
003 STO 2
004 R/S
005 STO 3
006 R/S
007 STO 4
008 R/S
009 STO 5
010 R/S
011 STO 6
012 R/S
-------------------------
013  (
014 RCL 3
015  x
016 RCL 5
017  )
018  -
019  (
020 RCL 2
021  x
022 RCL 6
023  )
024  =
025 STO 8
---------------------------
026  (
027 RCL 1
028  x
029 RCL 5
030  )
031  -
032  (
033 RCL 2
034  x
035 RCL 4
036  )
037  =
038 STO 0
-------------------------------
039 X=0
040 GTO 067
041 RCL 8
042  ÷
043 RCL 0
044  =
045 STO 7
046  (
047 RCL 1
048  x
049 RCL 6
050  )
051  -
052  (
053 RCL 3
054  x
055 RCL 4
056  )
057  =
058  ÷
059 RCL 0
060  =
061 X<>Y
062 RCL 7
063 R/S
064 Rv
065 Rv
066 GTO 000
------------------------------
067  0
068 FIX 9
069 PSE
070 FIX 2

Gamo
Find all posts by this user
Quote this message in a reply
01-16-2019, 04:46 AM
Post: #2
RE: (12C Platinum) Two Linear Equations in Two Unknowns
ALG Mode Program Version II

Procedure:
Same as above except when result is no solution
Display "Error 0"

-----------------------------------------------------
Program: ALG Mode
Code:

STO 0 R/S
STO 1 R/S
STO 2 R/S
STO 3 R/S
STO 4 R/S
STO 5   RCL 0 x RCL 4 - (RCL 3 x RCL 1) = STO 6
RCL 2 x RCL 4 - (RCL 1 x RCL 5) ÷ RCL 6 = R/S
RCL 0 x RCL 5 - (RCL 3 x RCL 2) ÷ RCL 6 =

Gamo
Find all posts by this user
Quote this message in a reply
01-16-2019, 01:36 PM (This post was last modified: 01-16-2019 02:01 PM by Albert Chan.)
Post: #3
RE: (12C Platinum) Two Linear Equations in Two Unknowns
(11-28-2018 08:15 AM)Gamo Wrote:  Example:

X + Y = -1
2X + 2Y = -2

Answer: No Solution

Answer should be infinite number of solutions, the line X + Y = -1
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)