Implementing Gaussian Elimination in C++ with Scaled Partial Pivoting

In summary, the programmer is having a problem understanding the program and needs help understanding it. They explain that they have been working on it for three hours and their mind has gone blank. They need help understanding the program so that they can get the gist of it. The programmer should use scaled partial pivoting and create a function that finds the best pivot row. Finally, they should do Gaussian elimination using the functions they have created.
  • #1
Isma
27
0
i m having serious problem regarding this program...i m not asking u 2 make it for me...just help me with logic because i can't get gist of it...pleasezz i need help...i ve working on it like 3 hours nd its like my mind has gone blank:(
 
Technology news on Phys.org
  • #2
write out in plain english what it is you need to do. then work out a psudo-code for it. after that it should be easy to get it down in C++.
 
  • #3
But not just any old plain english -- it ought to be clear and precise. I like to say that a young kid should be able to follow your directions to get the right answer!
 
  • #4
Will you use scaled partial pivoting? You should start by implementing your matrices and basic matrix operations. You can use 2D arrays for your matrices. You'll need basic functions like swapRows(R1, R2) and factorRow(PivotRow, RowToFactor, Multiplier) and printMatrix() for testing.
Then you should create a function that finds the best pivot row, if yu're using Scaled partial pivoting, then you select the row whose first non-zero element is the biggest relative to all the elements in its row.
Finally get down to Gaussian elimination, using the functions you have created.

What technique will you use for solving? Are you going to decompose the matrix into upper and lower triangular matrices?
If you want to solve for X in MX = B where M is a matrix and B is a vector, then you can split M into LU where L is lower triangular and U is upper triangular. Then you'd solve LY=B for Y with forward substitution and finally solve UX=Y for x, with backwards substitution. If you have to do things this way then it's a little more complicated, but you get better performance because your LU matrices are reusable whenever only B changes and M stays the same.
 
Last edited:

What is Gauss elimination?

Gauss elimination is a method used to solve systems of linear equations. It involves converting the system into an equivalent upper triangular system, which can then be easily solved by back substitution.

How is Gauss elimination implemented in C++?

In C++, Gauss elimination can be implemented using nested for loops to perform the necessary operations on the matrix representing the linear system. The algorithm can also be optimized by using techniques such as pivoting to reduce round-off errors.

What are the advantages of using Gauss elimination?

Gauss elimination is advantageous because it is a systematic and efficient method for solving systems of linear equations. It also allows for easy implementation in programming languages and can be used to solve large systems with many variables.

What are the limitations of Gauss elimination?

One limitation of Gauss elimination is that it can be computationally expensive for large systems of equations. Additionally, it may not work for systems with no solution or infinite solutions. It also requires careful handling of round-off errors.

How does Gauss elimination compare to other methods for solving linear systems?

Gauss elimination is generally considered one of the most reliable and efficient methods for solving linear systems. It is often preferred over other methods such as Cramer's rule or matrix inversion because it is less prone to errors and can handle larger systems more easily.

Similar threads

  • Calculus and Beyond Homework Help
Replies
1
Views
633
  • Programming and Computer Science
3
Replies
81
Views
5K
  • Programming and Computer Science
Replies
2
Views
1K
  • Mechanical Engineering
Replies
1
Views
686
  • Programming and Computer Science
Replies
3
Views
3K
  • Programming and Computer Science
Replies
4
Views
27K
  • Programming and Computer Science
Replies
2
Views
4K
  • Engineering and Comp Sci Homework Help
Replies
1
Views
2K
  • Programming and Computer Science
Replies
4
Views
4K
  • Programming and Computer Science
Replies
2
Views
3K
Back
Top