Skip to content

Python scripts made at the request of the Numerical Methods class professor, meant to be used in educational purposes.

Notifications You must be signed in to change notification settings

AnduBade02/NumericalMethodsVisualizerPython

Repository files navigation

# 📈 System Visualization: Solving Square Systems (GPP vs. G-S vs. Kaczmarz)

## 🌟 Project Context and Goal

This project was developed collaboratively with a colleague at the specific request of our professor. The primary goal is to provide a set of visualization tools to be used for teaching and demonstrating the behavior, steps, and convergence rates of various numerical methods for solving square linear systems.

## 🛠️ Technology Stack

The entire suite is built on Python, leveraging the following libraries for core functionality and visualization:

* **Core Language:** Python 3.x
* **Numerical Computing:** **NumPy** (`numpy`) for matrix operations, vector handling, and core algorithm implementation (GPP, G-S, Kaczmarz).
* **GUI:** **PyQt6** (`PyQt6.QtWidgets`, `PyQt6.QtCore`) for building the interactive desktop interfaces.
* **Plotting & Visualization:** **Matplotlib** (`matplotlib.pyplot`, `matplotlib.backends`) for integrating dynamic graphs and visualizing matrix elements within the PyQt GUI.
* **Data Handling:** Standard Python `csv` module for managing performance data.
### Running the Scripts

1.  **Dependency Installation:** Install all required libraries using the provided `requirements.txt` file:
    ```bash
    pip install -r ".\requirements.txt"
    ```
2.  **Execution:**
    * Navigate your terminal to the specific directory of the application you wish to run.
    * Execute the main Python script for that application.

### ⚠️ Important Note on Directories

Please be aware of the file naming conventions:

* Directories intended for **comparison visualizations** often contain two distinct Python files:
    * `Time_To_CSV.py`: Used for generating new timing data (running the algorithms and saving execution times to a CSV file).
    * `CSV_To_Plot.py`: Used for plotting the existing or newly generated data from the CSV file.

## 🔍 Application Descriptions

### 1. Gaussian Elimination with Partial Pivoting (GPP)

* **Interface:** Allows users to specify the matrix and vector size (between 2 and 10).
* **Visualization:** After manual or random data entry, the application represents the step-by-step modifications occurring in the matrix and vector.
* **Final Output:** The last step clearly shows the matrix transformed into its upper triangular form and the modified vector **b**.
* **Bonus:** The directory includes a presentation video showcasing the process.

### 2. Gauss-Seidel Method (G-S)

* **Interface:** Allows users to specify the matrix dimension.
* **Matrix Selection:** Choose the desired matrix type: **Random**, **Positive Semi-Definite**, or **Diagonally Dominant**.
* **Visualization:** Starting the algorithm generates a plot that describes the **norm of the solution vector (x)** at each iteration, clearly illustrating the algorithm's different behaviors across the three matrix cases.

### 3. Kaczmarz and Randomized Block Kaczmarz (Kaczmarz and RBK)

* **Note:** For detailed explanations of these algorithms, we highly recommend consulting the provided **`.ipynb` (Jupyter Notebook) file**.
* **Interface:** Similar to the Gauss-Seidel interface.
* **Configuration:** Set the matrix dimension and choose whether to enforce the **Diagonally Dominant** condition.
* **Convergence Plot:** Select the desired visualization type for convergence: **Normal Scale** or **Logarithmic Scale**.

### 4. GPP vs. G-S vs. Kaczmarz (Comparison)

* **Comparison Sets:** We provide two dedicated comparison directories:
    * One comparing **all three algorithms (GPP, G-S, Kaczmarz)**, requiring the diagonally dominant condition to ensure G-S convergence.
    * One comparing **GPP and Kaczmarz** without the diagonal dominance condition.
* **Plotting:** A **logarithmic scale** is used for the plot axes to clearly emphasize the differences in performance and convergence rates.
* **Time Generation:** The scripts for calculating new execution times can be run if desired. (**Warning:** Running this process can take a significant amount of time!)
* **Visual Aid:** The directory includes pre-generated images of the final comparison plots.

## 📧 Contact

For inquiries regarding the project's implementation or its use in teaching, feel free to reach out:

badescuandu2@gmail.com or https://www.linkedin.com/in/andu-badescu-80384a203/
tudor.popanica@stud.acs.upb.ro or https://www.linkedin.com/in/tudor-popanica-răboj-56149b2b3/

About

Python scripts made at the request of the Numerical Methods class professor, meant to be used in educational purposes.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published