Question

C++ , no ptrs or struct Solve a system of equations using the Gaussian Elimination technique....

C++ , no ptrs or struct

Solve a system of equations using the Gaussian Elimination technique.

The matrix will be 10X10 or smaller and will contain floats.
Then read in the matrix. Then read in the original answer column (see below for example).
Then using the element location 1,1 of the matrix (note I am using the mathematics convention of starting numbering at 1), you will change row 1 and also eliminate the other elements in column 0 using Gaussian elimination as discussed in class.
Then using element 2,2 of the matrix you will change row 2, then using row 2 you will eliminate all other elements in column 2 changing them to 0. Continue on until the matrix is transformed into an identity matrix.

At this point you will print out the final answer column.

EXAMPLE:

2x - 3y + z = -22
7x + 9y - 3z = 14
6x + 7y + 2z = 91

SAMPLE RUN DISPLAY:

Input the number of rows: 3
Input the matrix:
2 -3 1
7 9 -3
6 7 2
Input the answer column:
-22
14
91

The final answers are:
-4
11
19


Note:

The basic Gaussian elimination algorithm is:
begin by appending the answer column onto the nXn coefficient matrix.
You now have an n x n+1 matrix.

For the example above that would be

2 -3 1 -22
7 9 -3 14
6 7 2 91

The algorithm is now:

Remember the number of columns at this point is n+1, not n. The number of rows is still n.
For each row i
divide row i by element i,i (note this requires you to save the divisor before you start dividing)
for each row j not equal to i
the multiplier is the negative of element j,i
for each column k in row j
element j,k is replaced by element j,k + (element i,k * the multiplier)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

OUTPUT:-

Add a comment
Know the answer?
Add Answer to:
C++ , no ptrs or struct Solve a system of equations using the Gaussian Elimination technique....
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT