This console application, written in C++, provides implementations of several numerical methods for solving linear equations, non-linear equations, differential equations, and performing matrix inversion. All methods are modularly included in header files for easy integration and usage.
- Solution of Linear Equations
- Solution of Non-linear Equations
- Solution of Differential Equations
- Matrix Inversion
- Requirements
- How to Run
- Usage Example
The Jacobi method is an iterative technique to solve a system of linear equations. Each equation is solved for a specific variable, assuming the remaining variables' values are constant in each iteration. This method is suitable for diagonally dominant matrices.
The Gauss-Seidel method is similar to the Jacobi method, but each variable is updated as soon as a new value is available in each iteration. This often results in faster convergence than the Jacobi method.
The Gauss elimination method transforms a system of linear equations into an upper triangular matrix form. The solution can then be found using back-substitution. This method is one of the most commonly used elimination techniques.
Gauss-Jordan elimination extends Gauss elimination by transforming the matrix into a reduced row-echelon form. This allows for a direct reading of the solution without needing back-substitution.
LU factorization decomposes a matrix into the product of a lower triangular matrix (L) and an upper triangular matrix (U). This decomposition simplifies solving systems of linear equations, matrix inversions, and calculating matrix determinants.
The bisection method is a root-finding method that repeatedly divides an interval and selects a subinterval in which a root exists. The interval is chosen based on the change of sign of the function, ensuring that a root lies within the interval.
The false position method is similar to the bisection method but uses a secant line instead of the midpoint to find the root. This can converge faster for certain types of functions compared to bisection.
The secant method is a root-finding algorithm that uses a sequence of roots of secant lines to approximate the solution. This method doesn’t require knowledge of the derivative and can be faster than the bisection method.
The Newton-Raphson method uses the function's derivative to find successively better approximations to the root. It is known for its rapid convergence, although it requires an initial guess close to the actual root for best results.
The Runge-Kutta method is a popular technique for numerically solving ordinary differential equations (ODEs). The fourth-order Runge-Kutta is particularly well-known for its accuracy and stability, using four evaluations of the derivative per step to improve approximation.
Matrix inversion involves finding a matrix that, when multiplied with the original matrix, yields the identity matrix. The Gauss-Jordan elimination technique is commonly used for inverting matrices, especially when dealing with square matrices.
- C++ Compiler
Include the required header files in your project directory:
#include "2107100.hpp"
#include "2107086.hpp"
#include "2107102.hpp"
Run the main function provided below, which offers a console-based user interface to select and execute the different numerical methods.
Run the program to open the console-based interface.
- You will be prompted with a list of main categories:
- Solution For Linear Equations
- Solution of Non-linear Equations
- Solution of Differential Equations
- Matrix Inversion
- Exit
- Selecting Solution For Linear Equations will list options such as:
- Jacobi Iterative Method
- Gauss-Seidel Iterative Method
- Gauss Elimination
- Gauss-Jordan Elimination
- LU Factorization
- Similarly, choosing Solution of Non-linear Equations or Solution of Differential Equations will prompt for the specific method to use, such as:
- Bisection Method
- Secant Method
- Newton-Raphson Method
- Runge-Kutta Method for differential equations
After selecting a method, input any required parameters as prompted by the console. The program will execute the method and display the results directly.
Select Exit to close the application.