This repo is written as the final project of CAK2BAB2 (Analisis Kompleksitas Algoritma). You'll find implementations, visualizations, and notes about the algorithm 🧠.
It's a collection of linear equations which involve the same set of variables.
This system can be represented in matrix form as augmented matrix:
an augmented matrix for a system of equations is a matrix of numbers in which each row represents the equation and each column represents all the coefficients for a single variable.
The reduced row echelon form (RREF) of the matrix is:
A matrix is said to be in reduced row echelon form when it is in row echelon form and its basic columns are vector of the standard basis.
When the coefficient matrix of a linear system is in reduced row echelon form, it is straightforward to derive the solution of the system from the coefficient matrix and the vector of constants.
- Forward Elimination: Convert the matrix to an upper triangular form.
- Backward Elimination: Convert the upper triangular matrix to a diagonal matrix.
- Normalization: Scale the diagonal elements to 1 to achieve the RREF.
The code is structured to perform the following tasks:
- Read the input matrix.
- Apply the Gauss-Jordan elimination method.
- Output the solution to the system of equations.
// Example code snippet
#include <iostream>
#include <vector>
void gaussJordan(std::vector<std::vector<double>>& matrix) {
// Implementation of Gauss-Jordan elimination
}
int main() {
// Example usage of the solver
std::vector<std::vector<double>> matrix = {
{2, 1, -1, 8},
{-3, -1, 2, -11},
{-2, 1, 2, -3}
};
gaussJordan(matrix);
return 0;
}
To use the linear system solver, compile the code and run the executable. Provide the matrix as input, and the program will output the solution.
- Abdullah (103012330146): devdezzies
- Muhammad Febrian Hafiz (103012300332): swagenough