Skip to content

Mostafa-sh/numerical-methods

Repository files navigation

numerical-methods

numerical-methods

This is a repository for a collection of numerical methods in MATLAB. The main feature of this collection is avoiding for loops as much as possible and using the full capabilities of MATLAB array/matrix manipulation. The codes are general, efficient, and pack all the essential steps of the methods in only a few lines. Visualization, proof of convergence, validation, and comparison of methods are provided for many cases.

Each method is implemented in a single file with the following arrangement and is ready to execute in MATLAB.

%Name of the method
part 1
%Method_________________________________________________________________
part 2
%Illustration___________________________________________________________
part 3

Part 1 contains some inputs, part 2 contains the steps of the method, and part 3 contains an illustration of outputs, and in some cases, validation of the results and/or comparison with other methods.

For other projects, you can only use part 2 under "%Method___" and remove any other lines that commented at the end by "%for illustration", " %for validation", or "%for comparison".

To see the above picture, run this.

The numerical methods in this repository:

  1. Solving systems of linear equations
    1.1. Gaussian elimination
    1.2. Doolittle decomposition
    1.3. Crout decomposition
    1.4. Cholesky decomposition
    1.5. Gauss-Jordan elimination
    1.6. Jacobi method
    1.7. Gauss–Seidel method
    1.8. Conjugate gradient method
    1.9. Thomas method -- tridiagonal matrix

  2. Solving nonlinear equations
    2.1. Incremental search method
    2.2. Fixed-point method (1 equation)
    2.3. Regula falsi method
    2.4. Bisection method
    2.5. Newton method (1 equation)
    2.6. Secant method
    2.7. Fixed-point method
    2.8. Newton method
    2.9. Broyden method
    2.10. Pseudo-arclength continuation method
    2.11. Graeffe's method -- Polynomial root-finding (real)
    2.12. Laguerre's method -- Polynomial root-finding (real and complex)

  3. Interpolation and curve fitting methods
    3.1. Lagrange interpolation
    3.2.a. Forward Newton interpolation
    3.2.b. Backward Newton integration
    3.3. Hermite interpolation
    3.4.a. Lagrange based spline (order 1,2,3)
    3.4.b. Spline (order 1,2,3)
    3.5. Bandlimited interpolation
    3.6. Interpolation of periodic functions
    3.7.a. Least squares regression (any order)
    3.7.b. Weighted least squares regression (any order)

  4. Numerical differentiation
    4.1.a. Finite Difference Method (FDM)
    4.1.b. Generalized Finite Difference Method (FDM)
    4.2. Differentiation using interpolation
    4.3. Generalized Differential Quadrature (GDQ) method
    4.4. Partial differentiation
    4.5. Differentiation of periodic functions/data
    4.6. Differentiation in polar coordinates
    4.7. Fractional differentiation

  5. Numerical integration
    5.1. Rectangle rule
    5.2. Trapezoidal rule
    5.3.a. Simpson's 1/3 rule (uniform grid)
    5.3.b. Simpson's 1/3 rule
    5.4.a. Simpson's 3/8 rule (uniform grid)
    5.4.b. Simpson's 3/8 rule
    5.5. Gauss–Legendre quadrature
    5.6. Gauss–Laguerre quadrature (0 to inf integrals)
    5.7. Gauss-Hermite quadrature (-inf to inf integrals)
    5.8. Chebyshev–Gauss quadrature ( f(x)/sqrt(1-x^2) )
    5.9. Integration using Taylor series
    5.10. Integration in 2D
    5.11. Fredholm integral equations
    5.12. Volterra integral equations

  6. Solving Ordinary Differential Equations (ODEs)
    6.1.a. Explicit Euler method
    6.1.b. Implicit Euler method
    6.1.c. Modified explicit Euler method
    6.2. Midpoint method
    6.3. 2nd-order Runge-Kutta
    6.4. 3rd-order Runge-Kutta
    6.5. 4th-order Runge-Kutta
    6.6. Runge-Kutta Fehlberg/Merson method
    6.7. Explicit Adams-Bashforth method
    6.8. Implicit Adams-Bashforth method
    6.9. Newmark method

Releases

No releases published

Packages

No packages published

Languages