Skip to main content

A package that solves and graphs quadratic equations

Project description

Quadratic Solver

A powerful and easy-to-use Command Line Interface (CLI) application for solving and visualizing quadratic equations. This tool computes key properties of quadratic functions and provides a graphical representation of the curve.

🚀 Features

  • Solve quadratic equations of the form: ax² + bx + c = 0

  • Compute:

    • ✅ Real or complex roots
    • ✅ Discriminant
    • ✅ Vertex (turning point)
    • ✅ Axis of symmetry
    • ✅ Ordered pairs (for plotting)
    • ✅ Nature of roots (distinct, repeated, or complex)
  • 📈 Graph the quadratic function directly from the CLI

📦 Installation

Install via pip:

pip install quadratic-solver

🛠️ Usage

Run the CLI tool from your terminal:

quadratic-solver

You will be prompted to input the coefficients:

Enter coefficient a: 1
Enter coefficient b: -3
Enter coefficient c: 2

📊 Example Output

Quadratic Equation: 1x² - 3x + 2 = 0

Discriminant: 1
Roots: x₁ = 2, x₂ = 1

Nature of Roots: Real and Distinct

Vertex: (1.5, -0.25)
Axis of Symmetry: x = 1.5

Sample Points:
(0, 2)
(1, 0)
(2, 0)
(3, 2)

A graph window will also appear displaying the parabola.

📈 Graphing

The application automatically generates a plot of the quadratic function, highlighting:

  • The roots
  • The vertex
  • The curve shape (concave up or down)

🧠 How It Works

The app uses standard quadratic formula logic:

x = (-b ± √(b² - 4ac)) / (2a)
  • If the discriminant is:

    • > 0 → Two real roots
    • = 0 → One repeated root
    • < 0 → Two complex roots

Graphing is handled programmatically using Python plotting libraries.

🧪 Requirements

  • Python 3.10+

  • Required dependencies (installed automatically):

    • matplotlib
    • numpy

📁 Project Structure

quadratic_solver/
│── quadratic_model.py
│── run.py
│── solve_and_graph.py

🤝 Contributing

Contributions are welcome!

  1. Fork the repository
  2. Create a new branch
  3. Make your changes
  4. Submit a pull request

📜 License

This project is licensed under the MIT License.

💡 Future Improvements

  • Export graph as image file
  • Batch processing of multiple equations
  • Interactive mode with command flags

👨‍💻 Author

Built with ❤️ by Uchenna Adubasim

⭐ Support

If you find this project useful, consider giving it a star on GitHub!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quadratic_solver-1.0.0.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quadratic_solver-1.0.0-py3-none-any.whl (6.7 kB view details)

Uploaded Python 3

File details

Details for the file quadratic_solver-1.0.0.tar.gz.

File metadata

  • Download URL: quadratic_solver-1.0.0.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.3

File hashes

Hashes for quadratic_solver-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3c01bf530420dd3a4ac25a502905fc9332eafbf4c411a4680f0266cfc1e85314
MD5 b6388fe69c498dbfd03b46b2dad99906
BLAKE2b-256 57737aa0c48d894d24104106d305d02eab6d9292c07600d191e7cf9524964ac3

See more details on using hashes here.

File details

Details for the file quadratic_solver-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for quadratic_solver-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff2f35ad34731da07e26ec78776fcd6e4b2557f58a7968b9f0c4d6434a38ba2a
MD5 bcc2fce50d667dc7b5ad6ad80fea9cfa
BLAKE2b-256 dae5d2479e1c418209568a09ff946f620d8ff34bbba3ea6e84ea331efca173d6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page