Skip to content

MouradMahgoub/Equator

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Equator

Index

  1. Introduction
  2. Phase 1: System of Linear Equations
    1. Gauss Elimination
    2. Gauss Jordan
    3. LU Decomposition
      1. Doolittle's Method
      2. Crout's Method
      3. Cholesky's Method
    4. Gauss Seidel
    5. Jacobi-Iteration
  3. Phase 2: Root Finding
    1. Bisection
    2. False-Position
    3. Fixed Point
    4. Original Newton-Raphson
    5. Modified Newton-Raphson
      1. Modification 1
      2. Modification 2
    6. Secant Method

Introduction

The project "Equator" stands as a robust mathematical toolkit, built upon the foundation of Python and PyQt, enriched by the inclusion of powerful libraries such as NumPy, SymPy, and Matplotlib. Its overarching goal is to deliver efficient numerical solutions to a diverse array of mathematical challenges, with a specific emphasis on problems related to linear algebra and root finding. The project is divided into two phases, each of which is further subdivided into several modules. The first phase is dedicated to the solution of systems of linear equations, while the second phase is dedicated to the solution of root finding problems. The project is designed to be user-friendly, with a simple and intuitive graphical user interface (GUI) that allows the user to easily interact with the program and obtain the desired results.


Phase 1: System of Linear Equations

1. Gauss Elimination

$$ \begin{align*} &\text{Forward Elimination:} \\ &\begin{bmatrix} \begin{array}{ccc|c} a_{11} & a_{12} & a_{13} & b_1 \\ a_{21} & a_{22} & a_{23} & b_2 \\ a_{31} & a_{32} & a_{33} & b_3 \\ \end{array} \end{bmatrix} \sim \begin{bmatrix} \begin{array}{ccc|c} a_{11} & a_{12} & a_{13} & b_1 \\ 0 & a_{22}' & a_{23}' & b_2' \\ 0 & 0 & a_{33}'' & b_3'' \\ \end{array} \end{bmatrix}\\ &\text{Backward Substitution:} \\ &\begin{aligned} x_3 &= \frac{b_3''}{a_{33}''} \\ x_2 &= \frac{b_2' - a_{23}'x_3}{a_{22}'} \\ x_1 &= \frac{b_1 - a_{12}x_2 - a_{13}x_3}{a_{11}} \\ \end{aligned} \end{align*} $$

Sample Run

$$ \begin{aligned} 2x_1 + 3x_2 - 2x_3 &= 1 \\ 4x_1 + 4x_2 - 3x_3 &= 5 \\ 2x_1 - x_2 + 2x_3 &= 3 \\ \end{aligned} $$

Steps

Step 1: gauss elimination step 1 Step 2: gauss elimination step 2 Step 3: gauss elimination step 3 Step 4: gauss elimination step 4 Step 5: gauss elimination step 5 Step 6: gauss elimination step 6 Step 7: gauss elimination step 7 Step 8: gauss elimination step 8 Step 9: gauss elimination step 9 Step 10: gauss elimination step 10


2. Gauss Jordan

$$ \begin{align*} &\text{Forward and Backward Elimination:} \\ &\begin{bmatrix} \begin{array}{ccc|c} a_{11} & a_{12} & a_{13} & b_1 \\ a_{21} & a_{22} & a_{23} & b_2 \\ a_{31} & a_{32} & a_{33} & b_3 \\ \end{array} \end{bmatrix} \sim \begin{bmatrix} \begin{array}{ccc|c} a_{11} & 0 & 0 & b_1'' \\ 0 & a_{22}' & 0 & b_2'' \\ 0 & 0 & a_{33}'' & b_3'' \\ \end{array} \end{bmatrix} \ \\ &\text{Normalization:} \\ &\begin{bmatrix} \begin{array}{ccc|c} 1 & 0 & 0 & b_1''/a_{11} \\ 0 & 1 & 0 & b_2''/a_{22}' \\ 0 & 0 & 1 & b_3''/a_{33}'' \\ \end{array} \end{bmatrix} \begin{aligned} x_1 = \frac{b_1''}{a_{11}},\quad x_2 = \frac{b_2''}{a_{22}'} ,\quad x_3 = \frac{b_3''}{a_{33}''} \\ \end{aligned} \end{align*} $$

Sample Run

$$ \begin{aligned} 2x_1 + 3x_2 - 2x_3 &= 1 \\ 4x_1 + 4x_2 - 3x_3 &= 5 \\ 2x_1 - x_2 + 2x_3 &= 3 \\ \end{aligned} $$

gauss jordan sample run

Steps

Step 1: gauss jordan step 1 Step 2: gauss jordan step 2 Step 3: gauss jordan step 3 Step 4: gauss jordan step 4 Step 5: gauss jordan step 5 Step 6: gauss jordan step 6 Step 7: gauss jordan step 7 Step 8: gauss jordan step 8 Step 9: gauss jordan step 9


3. LU Decomposition

$$ A = LU \text{ where } L \text{ is a lower triangular matrix and } U \text{ is an upper triangular matrix}\\ $$

$$ LUx = b \implies Ux = y \text{ and } Ly = b $$

a. Doolittle's Method

$$ \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{bmatrix} =\begin{bmatrix} 1 & 0 & 0 \\ l_{21} & 1 & 0 \\ l_{31} & l_{32} & 1 \\ \end{bmatrix} \begin{bmatrix} u_{11} & u_{12} & u_{13} \\ 0 & a_{22} & u_{23} \\ 0 & 0 & u_{33} \\ \end{bmatrix} $$

Sample Run

$$ \begin{aligned} 3x_1 + 2x_2 - x_3 &= 1 \\ 2x_1 + 3x_2 + 2x_3 &= 2 \\ 5x_1 - x_2 + 4x_3 &= 3 \\ \end{aligned} $$

doolittle sample run

Steps

Step 1: doolittle step 1 Step 2: doolittle step 2 Step 3: doolittle step 3 Step 4: doolittle step 4


b. Crout's Method

$$ \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{bmatrix} =\begin{bmatrix} l_{11} & 0 & 0 \\ l_{21} & l_{22} & 0 \\ l_{31} & l_{32} & l_{33} \\ \end{bmatrix} \begin{bmatrix} 1 & u_{12} & u_{13} \\ 0 & 1 & u_{23} \\ 0 & 0 & 1 \\ \end{bmatrix} $$

Sample Run

$$ \begin{aligned} 3x_1 + 2x_2 - x_3 &= 1 \\ 2x_1 + 3x_2 + 2x_3 &= 2 \\ 5x_1 - x_2 + 4x_3 &= 3 \\ \end{aligned} $$

crout sample run

Steps

Step 1: crout step 1 Step 2: crout step 2 Step 3: crout step 3 Step 4: crout step 4


c. Cholesky's Method

$$ A = A^T \implies A = LL^T \\ $$

$$ \begin{bmatrix} a_{11} & a_{12} & a_{13} \\ a_{21} & a_{22} & a_{23} \\ a_{31} & a_{32} & a_{33} \\ \end{bmatrix} =\begin{bmatrix} l_{11} & 0 & 0 \\ l_{21} & l_{22} & 0 \\ l_{31} & l_{32} & l_{33} \\ \end{bmatrix} \begin{bmatrix} l_{11} & l_{21} & l_{31} \\ 0 & l_{22} & l_{32} \\ 0 & 0 & l_{33} \\ \end{bmatrix} $$

Sample Run

$$ \begin{aligned} 5x_1 + 2x_2 + x_3 &= 1 \\ 2x_1 + 6x_2 + 2x_3 &= 2 \\ 3x_1 + 2x_2 + 7x_3 &= 3 \\ \end{aligned} $$

cholesky sample run

Steps

Step 1: cholesky step 1 Step 2: cholesky step 2 Step 3: cholesky step 3 Step 4: cholesky step 4 Step 5: cholesky step 5 Step 6: cholesky step 6 Step 7: cholesky step 7


4. Gauss Seidel

$$ \begin{aligned} x_1^{(k+1)} &= \frac{b_1 - a_{12}x_2^{(k)} - a_{13}x_3^{(k)}}{a_{11}} \\ x_2^{(k+1)} &= \frac{b_2 - a_{21}x_1^{(k+1)} - a_{23}x_3^{(k)}}{a_{22}} \\ x_3^{(k+1)} &= \frac{b_3 - a_{31}x_1^{(k+1)} - a_{32}x_2^{(k+1)}}{a_{33}} \\ \end{aligned} $$

Sample Run

$$ \begin{aligned} &4x_1 + 2x_2 + x_3 &= 11 \\ &-1x_1 + 2x_2 &= 3 \\ &2x_1 + x_2 + 4x_3 &= 16 \\ &x_0 = (1, 1, 1) \\ \end{aligned} $$

gauss seidel sample run

Steps

Step 1: gauss seidel step 1 Step 2: gauss seidel step 2 Step 3: gauss seidel step 3 Step 4: gauss seidel step 4 Step 5: gauss seidel step 5 Step 6: gauss seidel step 6


5. Jacobi-Iteration

$$ \begin{aligned} x_1^{(k+1)} &= \frac{b_1 - a_{12}x_2^{(k)} - a_{13}x_3^{(k)}}{a_{11}} \\ x_2^{(k+1)} &= \frac{b_2 - a_{21}x_1^{(k)} - a_{23}x_3^{(k)}}{a_{22}} \\ x_3^{(k+1)} &= \frac{b_3 - a_{31}x_1^{(k)} - a_{32}x_2^{(k)}}{a_{33}} \\ \end{aligned} $$

Sample Run

$$ \begin{aligned} &4x_1 + 2x_2 + x_3 &= 11 \\ &-1x_1 + 2x_2 &= 3 \\ &2x_1 + x_2 + 4x_3 &= 16 \\ &x_0 = (1, 1, 1) \\ \end{aligned} $$

jacobi sample run

Steps

Step 1: jacobi step 1 Step 2: jacobi step 2 Step 3: jacobi step 3 Step 4: jacobi step 4 Step 5: jacobi step 5 Step 6: jacobi step 6 Step 7: jacobi step 7 Step 8: jacobi step 8 Step 9: jacobi step 9 Step 10: jacobi step 10 Step 11: jacobi step 11


Phase 2: Root Finding

1. Bisection

$$ x_{r} = \frac{x_{l} + x_{u}}{2} \begin{cases} x_{u} = x_{r}, & \text{if } f(x_{l}) \cdot f(x_{r}) < 0 \\ x_{l} = x_{r}, & \text{if } f(x_{l}) \cdot f(x_{r}) > 0 \\ \text{root} = x_{\text{r}}, & \text{if } f(x_{l}) \cdot f(x_{r}) = 0 \end{cases} $$

Sample Run

$$ f(x) = -12 - 21x + 18x^2 - 2.75x^3 $$

bisection sample run

Steps

Step 1: bisection step 1 Step 2: bisection step 2 Step 3: bisection step 3 Step 4: bisection step 4 Step 5: bisection step 5 Step 6: bisection step 6 Step 7: bisection step 7 Step 8: bisection step 8 Step 9: bisection step 9


2. False-Position

$$ x_{r} = \frac{x_{l} \cdot f(x_{u}) - x_{u} \cdot f(x_{l})}{f(x_{u}) - f(x_{l})} \begin{cases} x_{u} = x_{r}, & \text{if } f(x_{l}) \cdot f(x_{r}) < 0 \\ x_{l} = x_{r}, & \text{if } f(x_{l}) \cdot f(x_{r}) > 0 \\ \text{root} = x_{\text{r}}, & \text{if } f(x_{l}) \cdot f(x_{r}) = 0 \end{cases} $$

Sample Run

$$ f(x) = -12 - 21x + 18x^2 - 2.75x^3 $$

false position sample run

Steps

Step 1: false position step 1 Step 2: false position step 2 Step 3: false position step 3 Step 4: false position step 4 Step 5: false position step 5 Step 6: false position step 6 Step 7: false position step 7


3. Fixed Point

$$ x_{i+1} = g(x_{i}) $$

Sample Run

$$ f(x) = \sin{\sqrt{x}} - x, \quad g(x) = \sin{\sqrt{x}} $$

fixed point sample run

Steps

Step 1: fixed point step 1 Step 2: fixed point step 2 Step 3: fixed point step 3 Step 4: fixed point step 4 Step 5: fixed point step 5 Step 6: fixed point step 6 Step 7: fixed point step 7 Step 8: fixed point step 8 Step 9: fixed point step 9


4. Original Newton-Raphson

$$ x_{i+1} = x_i - \frac{f(x_i)}{f'(x_i)} $$

Sample Run

$$ f(x) = -0.9x^2 + 1.7x + 2.5 $$

original newton sample run

Steps

Step 1: original newton step 1 Step 2: original newton step 2 Step 3: original newton step 3 Step 4: original newton step 4 Step 5: original newton step 5


5. Modified Newton-Raphson

Modification 1:

$$ x_{i+1} = x_i - m \cdot \frac{f(x_i)}{f'(x_i)} $$

Sample Run

$$ f(x) = x^3 - 5x^2 + 7x - 3 $$

modified 1 newton sample run

Steps

Step 1: modified 1 newton step 1 Step 2: modified 1 newton step 2 Step 3: modified 1 newton step 3 Step 4: modified 1 newton step 4


Modification 2:

$$ x_{i+1} = x_i - \frac{f(x_i) \cdot f'(x_i)}{(f'(x_i))^2 - f(x_i) \cdot f''(x_i)} $$

Sample Run

$$ f(x) = x^3 - 5x^2 + 7x - 3 $$

modified 2 newton sample run

Steps

Step 1: modified 2 newton step 1 Step 2: modified 2 newton step 2 Step 3: modified 2 newton step 3 Step 4: modified 2 newton step 4


6. Secant Method

$$ x_{i+1} = x_i - \frac{f(x_i) \cdot (x_i - x_{i-1})}{f(x_i) - f(x_{i-1})} $$

Sample Run

$$ f(x) = x^3 - 6x^2 + 11x - 6.1 $$

secant sample run

Steps

Step 1: secant step 1 Step 2: secant step 2 Step 3: secant step 3

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%