Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Quadratic equation
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
===Avoiding loss of significance=== Although the quadratic formula provides an exact solution, the result is not exact if [[real number]]s are approximated during the computation, as usual in [[numerical analysis]], where real numbers are approximated by [[floating point number]]s (called "reals" in many [[programming language]]s). In this context, the quadratic formula is not completely [[numerical stability|stable]]. This occurs when the roots have different [[order of magnitude]], or, equivalently, when {{math|''b''<sup>2</sup>}} and {{math|''b''<sup>2</sup> β 4''ac''}} are close in magnitude. In this case, the subtraction of two nearly equal numbers will cause [[loss of significance]] or [[catastrophic cancellation]] in the smaller root. To avoid this, the root that is smaller in magnitude, {{math|''r''}}, can be computed as <math>(c/a)/R</math> where {{math|''R''}} is the root that is bigger in magnitude. This is equivalent to using the formula <math display="block">x =\frac{-2c}{b \pm \sqrt {b^2-4ac}}</math> using the plus sign if <math>b>0</math> and the minus sign if <math>b<0.</math> A second form of cancellation can occur between the terms {{math|''b''<sup>2</sup>}} and {{math|4''ac''}} of the discriminant, that is when the two roots are very close. This can lead to loss of up to half of correct significant figures in the roots.<ref name="kahan"/><ref name="Higham2002">{{Citation |first=Nicholas |last=Higham |title=Accuracy and Stability of Numerical Algorithms |edition=2nd |publisher=SIAM |year=2002 |isbn=978-0-89871-521-7 |page=10 }}</ref>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)