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

ax2+bx+c=0,

where a,b,cR and a0.

The expression

Δ=b24ac

is called the discriminant of the quadratic equation. The sign of Δ determines the number of real-valued solutions:

The real-valued solutions can be determined as:

x1=bΔ2a   en   x2=b+Δ2a

Assignment

Example

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

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