A quadratic equation is any equation that can be rearranged in standard form as

\[ax^2 + bx + c = 0\,,\]

where \(a, b, c \in \mathbb{R}\) and \(a \neq 0\).

The expression

\[\Delta = b^2 - 4ac\]

is called the discriminant of the quadratic equation. The sign of \(\Delta\) determines the number of real-valued solutions:

The real-valued solutions can be determined as:

\[x_{1} = \frac{-b - \sqrt{\Delta}}{2a}\ \ \ \text{en}\ \ \ x_{2} = \frac{-b + \sqrt{\Delta}}{2a}\]

Assignment

Example

>>> discriminant(1, 0, -1)
4.0
>>> discriminant(1, 4, -5)
36.0

>>> solutions(1, 0, -1)
(1, -1.0, 1.0)
>>> solutions(1, 4, -5)
(1, -5.0, 1.0)