Skip to main content

Solve quadratic equations using the quadratic formula and completing the square.

Project description

quadratic-solver-freeman

A Python package to solve quadratic equations (ax² + bx + c = 0) using two methods:

  • Quadratic Formula — direct application of the formula
  • Completing the Square — algebraic step-by-step method

Supports both real and complex roots.


Installation

pip install quadratic-solver-freeman

Usage

from quadratic_solver_freeman import solve_by_formula, solve_by_completing_square

# Real roots: x² - 5x + 6 = 0
r1, r2 = solve_by_formula(1, -5, 6)
print(r1, r2)  # 3.0  2.0

# Repeated root: x² - 2x + 1 = 0
r1, r2 = solve_by_completing_square(1, -2, 1)
print(r1, r2)  # 1.0  1.0

# Complex roots: x² + x + 1 = 0
r1, r2 = solve_by_formula(1, 1, 1)
print(r1, r2)  # (-0.5+0.866j)  (-0.5-0.866j)

Methods

Function Method
solve_by_formula(a, b, c) Quadratic formula
solve_by_completing_square(a, b, c) Completing the square

Both return a tuple (x1, x2) and raise ValueError if a = 0.


License

MIT

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_freeman-0.1.0.tar.gz (2.6 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_freeman-0.1.0-py3-none-any.whl (3.2 kB view details)

Uploaded Python 3

File details

Details for the file quadratic_solver_freeman-0.1.0.tar.gz.

File metadata

File hashes

Hashes for quadratic_solver_freeman-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a2c708b9e5286ad349dd45b9078f3d394ada811b2b3bc16cebf37443eb1431c
MD5 a9eed83112f0564cb30c8fb2f23a111b
BLAKE2b-256 38d70a7a2148f6ccbd1e68e869e7b76c2b517b05003eb4174f6842fc71380c3b

See more details on using hashes here.

File details

Details for the file quadratic_solver_freeman-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for quadratic_solver_freeman-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a34c54d4990b31719c2db7907f9f65656c8f8cd7daaf06a06a566841c1c6fe8c
MD5 be87179c5f74b4e54495131eab709515
BLAKE2b-256 57cb9fc8528e5604d2146b52b37f97e1ea2ccc975e4e4b56aa8114f20596c3b2

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