Quadratic Formula#

pyquations.algebra.quadratic_formula.quadratic_formula(a: float, b: float, c: float) Tuple[complex, complex][source]
This function calculates the roots of a quadratic equation of the form:

ax^2 + bx + c = 0

Parameters:
  • a (float) – Coefficient of the quadratic term (x^2). Must not be zero.

  • b (float) – Coefficient of the linear term (x).

  • c (float) – Constant term.

Returns:

A tuple containing two roots of the quadratic

equation. The roots may be real or complex numbers depending on the discriminant.

Return type:

Tuple[complex, complex]

Raises:

ValueError – If ‘a’ is zero, as this would not represent a quadratic equation.