I created this project to test my Python knowledge as part of my academic studies. It helped me learn how to build GUI applications, work with custom modules, and visualize mathematical concepts using Python and Matplotlib.
Quadratic Equation Calculator is a Python-based GUI application designed to solve quadratic equations of the form ax² + bx + c = 0. Built using Tkinter, it provides a user-friendly interface to calculate determinants, roots (real or complex), and visualize the quadratic curve.
- Intuitive GUI: Enter coefficients and interact with easy-to-use buttons.
- Determinant Calculation: Instantly compute the determinant (b² - 4ac) of the quadratic equation.
- Root Calculation: Get both real and complex roots using robust custom logic.
- Interactive Graph: Visualize the equation’s curve and save the plot as an image.
- Clear & Exit: Easily reset input fields or exit the application.
Install required dependencies with:
pip install -r requirements.txt
Packages Used:
matplotlib
(for plotting graphs)tkinter
(GUI, comes pre-installed with Python)math
(real root calculations, comes pre-installed)cmath
(complex root calculations, comes pre-installed)
- Enter Coefficients: Input values for
x²
,x
, and the constant term in the respective fields. - Calculate Roots: Click Calculate Roots to view the determinant and roots.
- View Graph: Click Graph for an interactive plot of the quadratic equation. You can save the graph as an image.
- Clear Fields: Click Clear to reset all fields and close any open graph window.
- Exit: Click Exit or close the window to quit.
Quadratic-Equation-Calculator/
├── README.md
├── calc.py # Main GUI and application logic
├── LICENSE # GNU GPL v3 License
├── requirements.txt # Required Python packages
└── logic/
├── __init__.py
├── determinant.py # Function to compute determinant
└── roots.py # Function to compute roots (real/complex)
-
Custom Modules:
logic/determinant.py
: Calculates the determinant (D = b² - 4ac).logic/roots.py
: Calculates both real and complex roots usingmath
andcmath
modules.
-
Main GUI (
calc.py
):- Uses Tkinter for input fields, labels, and buttons.
- Handles placeholder text, root calculation, graph plotting, and GUI layout.
# Calculate determinant
from logic import determinant
d = determinant.det(a, b, c)
# Calculate roots
from logic import roots
r = roots.root(a, b, c)
This project is licensed under the GNU General Public License v3.0.
Created by abhishekmallav
Feel free to fork, contribute, or raise issues. Pull requests are welcome!
For any questions or feedback, please open an issue or reach out via GitHub.