Simultaneous Linear Equations in Calculators

18
Multiple linear equation solution in calculators Some problems in dynamics produce a system of linear equations that can be easily solved in the HP or TI calculators. For example, problem 13.24 in Hibbeler' s textbook requires t he solution of the following three simultaneous linear equations: (1) T m  B a  B = k m  B  g (2) 2 T m  A a  A =m  A  g (3) 2 a  A a  B = 0 These three equations can be re-written as: (1) T  0 a  A m  B a  B = k m  B  g (2) 2 T m  A a  A 0 a  B = m  A  g (3) 0 T 2 a  A a  B =0 Using matrices, if we write: A = [ 1 0 m  B 2 m  A 0 0 2 1 ] , x = [ T a  A a  B ] , and b = [ k m  B  g m  A  g 0 ] , the system of equations can be written as the matrix equation: A x = b, whose solution is x = A -1  b, where A -1 is the inverse matrix of A. Next, the solution of this matrix equation is presented using the HP and TI calculators. Solution with the HP calculators The matrix solution us ing an HP 48Gii, HP 49G, HP 49G+, or HP 50G calculator is shown next. Make sure your calculator is in the RPN mode, and in the  Exact mode. Follow these instructions to create matrix A: 1. Act iva te the matr ix wr ite r (MTWR) b y usi ng [ ][MTWR ]. This will show the following “spreadsheet” form in your screen: 1

Transcript of Simultaneous Linear Equations in Calculators

Page 1: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 1/18

Multiple linear equation solution in calculatorsSome problems in dynamics produce a system of linear equations that can be easily solved in the HP or

TI calculators. For example, problem 13.24 in Hibbeler's textbook requires the solution of the

following three simultaneous linear equations:

(1) T −m B⋅a B=k ⋅m B⋅ g 

(2) 2⋅T m A⋅a A=m A⋅ g (3) 2⋅a A−a B=0

These three equations can be re-written as:

(1) T 0⋅a A−m B⋅a B=k ⋅m B⋅ g 

(2) 2⋅T m A⋅a A0⋅a B=m A⋅ g 

(3) 0⋅T 2⋅a A−a B=0

Using matrices, if we write:

A = [1 0 −m B

2 m A 0

0 2 −1 ] , x = [T 

a A

a B] , and b = [

k ⋅m B⋅ g 

m A⋅ g 

0 ] ,

the system of equations can be written as the matrix equation: A⋅x = b, whose solution is x = A-1⋅ b,

where A-1 is the inverse matrix of A.

Next, the solution of this matrix equation is presented using the HP and TI calculators.

Solution with the HP calculators

The matrix solution using an HP 48Gii, HP 49G, HP 49G+, or HP 50G calculator is shown next. Makesure your calculator is in the RPN mode, and in the Exact mode. Follow these instructions to create

matrix A:

1. Activate the matrix writer (MTWR) by using [][MTWR ]. This will show the following

“spreadsheet” form in your screen:

1

Page 2: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 2/18

2. Type the first row in matrix A as follows:[1][SPC][0][SPC][ ' ][+/-][ALPHA][][M][ALPHA][B][ENTER].

3. Press [][][][] to place the cursor in the first column of the second row.

4. Type the second row in matrix A as follows:

[2][SPC][ ' ][ALPHA][

][M][ALPHA][A][

][SPC][0][ENTER]

5. This time the cursor goes automatically to the first column of the third row. Type the third row

as follows:

[0][SPC][2][SPC][1][+/-][ENTER]

6. Press [ENTER] once more to display the matrix in the stack:

7. At this point we can store this matrix into a variable A, as follows: [ ' ][A][ENTER][STO].

The matrix will disappear from the stack and a new variable [ A ] will be shown:

You can always recall the value of A into the stack by pressing the soft-menu key corresponding

to variable A. In the case shown above you would press [F1] to recover the contents of A.

Next, we'll enter vector b as follows:

1. Activate the matrix writer (MTWR) by using [][MTWR ].

2. Type the first element in the vector as follows:

[ ' ][ALPHA][][M][ALPHA][][K][×][ALPHA][][M][ALPHA][B][×]

[ALPHA][][G][ENTER]

3. Press [][] to place the cursor in the first column of the second row.

4. Type the second element in the vector as follows:

[ ' ][ALPHA][][M][ALPHA][A][×][ALPHA][][G][ENTER]

5. The last element in the vector is simply: [0][ENTER]

2

Page 3: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 3/18

6. Press [ENTER] once more to see the vector listed in the stack:

7. Type ['][ALPHA][][B][STO] to store the vector in variable b. Variables A and b should beavailable in the soft menu keys. If you don't see those variables, press [VAR].

8.

To calculate the solution x = A-1⋅ b, we proceed as follows:

1. Press the soft-menu key for variable [ A ]

2. Press [1/x]. This will produce the inverse of matrix A, i.e., A-1:

3. Press the soft-menu key for variable [ b ].

4. Press [×].

5. Type [ ' ][X][ENTER][STO] to store a copy of the solution.

6. Press the soft-menu key [ x ] to recover the solution to the stack.

The result shown is the solution corresponding to T, a A , and a B:

3

Page 4: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 4/18

These results can be simplified further as follows:

1. Decompose the vector into its components by using the function OBJ. This function is

available in the catalog: [][CAT][ALPHA][O]. Function happens to be the first in the list of functions that start with the letter “O”. Press [ OK ] to activate the function.

The stack shows at level 1 the list {3. 1.}, which indicates the number of rows and columns of the vector just decomposed. While levels 2, 3, and 4, respectively, correspond to rows 3, 2, and

1, in the vector. Thus, the element in stack level 2 is a B .

2. Drop the list in level 1 by using []. Now, the term in stack level 1 is a B . Press the [] key toactivate the equation writer. The screen will show now the following:

3. Press the soft-menu keys for [SIMP] (SIMPlifiy) and [FACTO] (FACTOr) to produce:

Thus, the value of a B can be written as:

a B=2⋅ g ⋅ m A−2⋅k ⋅m B

m A4⋅m B

4. Press [ENTER] to see this result in the stack. The simplified expression just found for wouldhave replaced the original expression for a B in the stack.

If need be to keep this result in memory, you could store it into a variable aB, as follows:

[ ' ][ALPHA][][A][ALPHA][B][STO]

4

Page 5: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 5/18

If you don't need this result anymore, press [] to remove it from the stack.

5. The expression for a A will now be available in stack level 1. Use [][SIMP][FACTO] to

simplify this expression in the equation writer:

Thus, the value of a A can be written as:

a A= g ⋅m

 A−2⋅

k ⋅m

 B

m A4⋅m B

6. Press [ENTER] to see this result in the stack. Use [ ' ][ALPHA][][A][ALPHA][B][STO] if 

you want to store the result in a variable aA. Or, simply press [] to delete the result from thestack if no longer needed.

7. The expression for T will now be available in stack level 1. Use [][SIMP][FACTO] tosimplify this expression in the equation writer:

Thus, the value of T can be written as:

T =m A⋅m B⋅ g ⋅k 2m

 A4⋅m

 B

8. Press [ENTER] to see this result in the stack. Use [ ' ][ALPHA][T][STO] if you want to store

the result in a variable T . Or, simply press [] to delete the result from the stack if no longer

needed.

5

Page 6: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 6/18

Using stored variables in the HP calculatorsIn my calculator I saved all the expressions, so that I end up with the following variables (folder MESf 

was already available):

These variables can be used to evaluate specific values. For example, if m A = 0.31 slug , m B = 0.12

slug , g = 32.2 ft/s2 , and μ k  = 0.2, I can evaluate the expression for a A as follows:

1. Press the soft-menu key [ aA ] to recover the expression in the stack.

2. Press [] to activate the equation writer. The expression will be highlighted.

3. Press [][ | ][ALPHA][][M][ALPHA][A][][0][.][3][1][][] to produce this result:

4. Press the [EVAL] soft-menu key to produce the substitution indicated. The result is:

5. Press [][ | ][ALPHA][][M][ALPHA][B][][0][.][1][2][][] to produce this result:

6. Press the [EVAL] soft-menu key to produce the substitution indicated. Since there is already a

decimal value (0.31) in the expression, you will be asked to change the CAS mode to Approx.

Accept this change by pressing [ OK ]. The result is:

7. Next, press [][ | ][ALPHA][][G][][3][2][.][2][][] to produce this result:

6

Page 7: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 7/18

8. Press the [EVAL] soft-menu key to evaluate the substitution indicated. Parts of the result will

be shown in the screen as follows:

9. Next, press [][ | ][ALPHA][][M][ALPHA][][K][][0][.][2][][] [EVAL][EVAL] toevaluate the final result, i.e.,

i.e., a A = 10.67 ft/s2.

A similar approach can be used to evaluate a B and T .

It is possible to substitute more than one value at a time using the stack. For example, to evaluate theexpression for T , we can do the following:

1. Press the soft-menu key for variable T , i.e., [ T  ].2. Create the following list: {mA 0.31 mB 0.12 g 32.2 μk 0.2} by using:

[][{}][ALPHA][][M][ALPHA][A][][SPC][0][.][3][1][SPC]

[ALPHA][][M][ALPHA][B][][SPC][0][.][1][2][SPC][ALPHA][][G][][SPC][3][2][.][2][SPC]

[ALPHA][][M][ALPHA][][K][][SPC][0][.][2]

The screen will look like this (remember, we're using RPN mode):

3. Next, press [][ | ] to effect the substitutions.

4. Finally, press [EVAL] to calculate the final result:

Thus, T = 3.34 lb.

7

Page 8: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 8/18

Deleting variables in the HP calculatorSuppose that we have finished calculations using variables T, aA, aB, b, and A, and you want to delete

these variables from your calculator's memory. The simplest way to proceed is as follows:

1. Press [VAR], if needed, to produce the listing of variables as shown in the screen shot

immediately above.

2. Create the list:{T aA aB b A}

by using:

[][{}][ T  ][ aA ][ aB ][ b ][  A ][ENTER]

3. Press [TOOL][PURGE]. The list will dissapear from the stack. Press [VAR] to verify that

variables T, aA, aB, b, and A have been deleted from memory.

Solving numerical matrix equations in the HP calculators

Although the example shown above uses matrices that include variables in their elements, solutions

with purely numerical matrices can be implemented in a similar manner.

Consider the system of equations:

(1) 3⋅ x −2⋅ y5⋅ z =5

(2) 0⋅ −3⋅ z =−2

(3) 5⋅ x 2⋅ y z =3

The system is equivalent to the matrix equation A⋅x = b, with

A = [3 −2 5

1 0 −3

5 2 1 ] , x = [ x 

 y

 z ] , and b = [5

−2

3 ] ,

In RPN mode, matrices can be entered by using square brackets [][[ ]] and [SPC]. This is analternative way to enter matrices into HP calculators without using the matrix writer. To enter matrix A

use:

[][[ ]] [][[ ]] [3][SPC][2][+/-][SPC][5][]

[][[ ]] [1][SPC][0][SPC][3][+/-][][][[ ]][5][SPC][2][SPC][1][ENTER]

Matrix A will be shown in the screen:

Press [ENTER] to keep an additional copy of the matrix. Then, press [1/x] to calculate the inverse. If 

your calculator is in Exact mode, the screen will show the following result:

8

Page 9: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 9/18

Next, enter vector b as follows: [][[ ]] [][[ ]][5] [][][[ ]][2][+/-] [][][[ ]][3][ENTER]

The screen will show the inverse of matrix A, A-1, in stack level 2 and vector b in stack level 1:

At this point, one can press [×] to calculate vector x = A-1⋅b:

The solution to the matrix equation is therefore, x = 2/5 , y = 1/10, and z = 4/5 . If you press [][NUM],

the solutions are shown in floating-point format, i.e., x = 0.4, y = 0.1, and z = 0.8.

Using the numerical solver in the HP calculatorsA numerical solver for linear systems is available in the HP calculators through [][NUM.SLV] by

selection option 4. Solve lin sys... The calculator screen will show the options as in the figure below.

Press [ OK ] to select the highlighted option:

The resulting screen is the following:

9

Page 10: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 10/18

Here we enter matrix A and vector B (we called it b before) using eigther square brackets and spaces,or using the matrix writer. To activate the matrix writer, press the [EDIT] soft-menu key. Press

[ENTER] when done creating the matrix to return to the linear equation solver. Press [ENTER] or

[ OK ] to enter matrix A and to move cursors to vector B. For example, repeating the example shownabove, the screen will look like this once we have entered matrix A:

After entering vector B, the linear solver screen will look like this:

At this point, the field for the solution X is selected. Press [SOLVE] to obtain a solution. Press

[ENTER] to see the solution listed in the stack:

10

Page 11: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 11/18

Using the Multiple-equation SoLVer in the HP calculatorsThe Multiple-equation SoLVer (MSLV) in the HP calculators is available as option 6.MSLV in the

numerical solvers ([][NUM.SLV]). Before activating it, however, we need to have the stack prepared as

follows:

3: [equations to be solved, within quotes, and separated by a space]

2: [variables we are solving for, within quotes, and separated by a space]1: [initial guesses for the solution, separated by a space]

Consider the system of equations:

(1) 3⋅ x −2⋅ y5⋅ z =5

(2) 0⋅ −3⋅ z =−2

(3) 5⋅ x 2⋅ y z =3

Type the list of equations to be solved as follows:

['3*x-2*y+5*z=5' 'x-3*z=-2' '5*x+2*y+z=3'] [ENTER]

['x' 'y' 'z'] [ENTER]

[1 -1 3] [ENTER]

Note: Use [SPC] to separate equations, variables, or values in these three vectors.

The screen, showing the equations, variables, and initial guesses for the solutions, is ready as shown

below:

To activate the solution press [][NUM.SLV][6][ OK ].

The MSLV will be activated showing calculations at the top of the screen. When a solution is found, it

will be reported in the vector in stack level 1.

To see the final results press []. This will activate the matrix writer.

You can use the [] and [] keys to move about the solution.

The results shown are: x = 0.4 , y = 0.100000000002 (i.e., basically, y = 0.1), and z = 0.8.

Press [ENTER] to return to normal calculator display.

Note: the MSLV was used here to solve for a system of linear equations. However, it can be used to

solve any system of non-linear and/or linear equations. For example, try the following example:['X^2+Y^2=25' 'X+Y=7'],['X' 'Y'],[0 1]. The solution is [3 4], i.e., X = 3 and Y = 4.

11

Page 12: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 12/18

Solution using the TI 89 Titanium calculatorRecall that in the first problem proposed we had the matrices

A = [1 0 −m B

2 m A 0

0 2 −1] , x = [

a A

a B] , and b = [

k ⋅m B⋅ g 

m A⋅ g 

0] ,

forming the matrix equation: A⋅x = b, whose solution is x = A-1⋅ b.

To enter matrices in the TI 89 Titanium calculator, simply use square brackets and commas. Thus,matrix A will be entered as: [[1,0,-mB][2,mA,0][0,2,-1]][ENTER]

The resulting matrix is shown as:

To store this matrix into variable a, use:[STO][ALPHA][A]. The screen will show the following:

The expression ans(1) represents the most recent result in the calculator's screen, i.e., the matrixentered above. The screen will confirm the storing of matrix a as shown below:

To recall matrix a, simply type [ALPHA][A][ENTER]. This shows:

12

Page 13: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 13/18

To enter vector b, type: [[μk*mb*g][ma*g][0]] [STO][ALPHA][B].

[NOTE: Character μ can be found using [2nd][CHAR ][], then scrolling down to find μ.]

This results in:

To calculate the solution, x = A-1⋅ b, use: [ALPHA][A][^][(][(-)][)][×][ALPHA][B][ENTER], i.e.,

This screen confirms the results found earlier, namely,

T =m A⋅m B⋅ g ⋅k 2m

 A4⋅m

 B

, a A= g ⋅m A−2⋅k ⋅m Bm A4⋅m B

, and a B= 2⋅ g ⋅ m A−2⋅k ⋅m Bm A4⋅m B

.

The resulting vector can be stored into variable x as follows: [STO][ X ].

13

Page 14: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 14/18

Using the elements of vector x in the TI 89 Titanium calculatorWe know that the elements of vector x represent respectively T, a A , and a B. Suppose that we want to

evaluate T given m A = 0.31 slug , m B = 0.12 slug , g = 32.2 ft/s2 , and μ k  = 0.2. Proceed as follows:

1. Recall the value of  x[1] as shown in the screen shot below:

2. Notice that the result is shown in brackets. Thus, to eliminate the brackets, press [CLEAR][]

[ENTER], and edit the brackets out using [] and []. Press [ENTER] when done. The final

result will be:

3. Press [2nd][] to move to the end of the line, and press [ | ]. Then add the entry ma = 0.31,

and press [ENTER]. The result is:

This shows the substitution of a single variable into the expression. To substitute the remaining

values, we can use the following (NOTE: the command and is available through thecatalog: [CATALOG][ALPHA][ALPHA][A][][ENTER]):

4. Press [CLEAR][][ENTER]. Make sure you are at the end of the line (use [2nd][], if 

needed), and type: [ | ] followed by mb = 0.12 and g = 32.2 and mk = 0.2 [ENTER].

The result is:

14

Page 15: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 15/18

i.e., T = 3.34 lb.

Deleting variables used in the TI 89 Titanium

Since we used three variables a, b, and x , which are single-letter variables, we can simply use the

option [2nd][F1] (i.e., F6 – Clean Up), followed by [ENTER] (option 1:Clear a-z is the default), to

delete those variables.

The calculator will produce the following dialogue box to confirm the deletion of all single-letter

variables from a to z :

Press [ENTER] to delete the variables.

Numerical example in the TI 89 Titanium

Note: this example is slightly different from the numerical example used for the HP calculators.

Therefore, you should not expect to get the same results.

Consider the system of linear equations:

(1) 3⋅ x −2⋅ y5⋅ z =5

(2) 0⋅ −3⋅ z =−2

(3) 5⋅ x 2⋅ y− z =3

This system is equivalent to the matrix equation A⋅x = b, with

A =

[3 −2 5

1 0 −35 2 −1]

, x =

[ x 

 y z ]

, and b =

[5

−23 ]

.

Enter matrix A in the calculator:

15

Page 16: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 16/18

Enter the last closing square bracket [2nd][ ]] and press [ENTER] to show:

Next, calculate the inverse: [CLEAR][][ENTER][^][(-)][1][ENTER], which shows:

Next, enter vector b, as follows:

To calculate x = A-1⋅ b, use: [CLEAR][][][][ENTER][×][][ENTER].The result is:

i.e., x = 4/7, y = 1/2, and z = 6/7 .

Using [♦][≈] (i.e., [♦][ENTER]) produces the results x = 0.571429, y = 0.5, and z = 0.857143.

16

Page 17: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 17/18

Using the Simultaneous Equations Solver in the TI 89 Titanium calculatorThis APP is available for download from the TI web site, and is preloaded in TI 89 Titanium

calculators:

http://education.ti.com/educationportal/sites/US/productDetail/us_ti89ti.html?bid=7

The name Simultaneous Equation Solver is misleading. Unlike the HP's MSLV, the TI's Simultaneous Equation Solver can only solve linear equations, thus, a more appropriate name would have been

Simultaneous Linear Solver.

To selecte this APP, find the icon in your APPS desktop, and press [ENTER].

Select the option 3. New.., and enter 3 into both options Number of Equations and Number of 

Unknowns. Press [ENTER]. The resulting screen is shown below:

To enter the coefficients for the following system:

(1) 3⋅ x −2⋅ y5⋅ z =5

(2) 0⋅ −3⋅ z =−2

(3) 5⋅ x 2⋅ y− z =3

17

Page 18: Simultaneous Linear Equations in Calculators

7/31/2019 Simultaneous Linear Equations in Calculators

http://slidepdf.com/reader/full/simultaneous-linear-equations-in-calculators 18/18

navigate through the spreadsheet and press [ENTER] after typing each entry. The spreadsheet shouldlook like this when all the entries are done:

The options in the F1-F7 utility keys include, among others, [F3] Store to save data in memory, and

[F5] Solve. Press [F5] Solve to obtain the following solution:

This document was prepared by Gilberto E. Urroz, June 2007.

18