A quadratic equation is any equation that can be rearranged in standard form as
where
The expression
is called the discriminant of the quadratic equation. The sign of
if
als
als
The real-valued solutions can be determined as:
Write a function discriminant
that takes the three parameters int
or float
) of a quadratic equation. The function must return the discriminant float
) of the quadratic equation.
Write a function solutions
that takes the three parameters int
or float
) of a quadratic equation. The function must return three values: i) the number of different real-valued solutions (int
) of the quadratic equation, ii) the solution float
) of the quadratic equation and iii) the solution float
) of the quadratic equation. If the quadratic equation has no real-valued solution, the value
>>> 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)