next up previous
Next: Precision Up: quadratic Previous: quadratic

Roots of a Quadratic: quadratic.py

Suppose we want to solve a quadratic equation

\begin{displaymath}
ax^2 + bx + c = 0.
\end{displaymath}

The standard solution is

\begin{displaymath}
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}.
\end{displaymath}

While this result is correct mathematically, it might cause problems if we use it with numbers that have only limited precision, as we now explain:



Subsections

Carleton DeTar 2017-09-05