1
$\begingroup$

Take the polynomial $x^2+(-4*10^3)x+2$.

In the floating-point system with $b=10$, $m=4$, $e=4$, if I wanted to find the roots using the quadratic formula what would be the values of the roots?

I got 3.999 as one of my roots and 1.000 as the other but my 1.000 root does not make sense in terms of relative error (I get a huge number).

Could anyone help me with this by going through the steps?

$\endgroup$
  • 1
    $\begingroup$ I expect you got $3.999\times 10^3$, not $3.999$ for the large root. $\endgroup$ – André Nicolas Jan 16 '15 at 3:19
1
$\begingroup$

If you apply the classical method for the solution of quadratic equations, the roots are given by $$x_{\pm}=\frac{4\times 10^3\pm \sqrt{16\times 10 ^6-8}}{2}=2\times 10^3\pm \sqrt{4\times 10 ^6-2}$$ $$x_{\pm}=2000 \Big(1\pm\sqrt{1-\frac{1}{2\times 10^6}}\Big)=2000 \Big(1\pm\sqrt{1-{5\times 10^{-7}}}\Big)$$ Now, using Taylor $$\sqrt{1-\epsilon}=1-\frac{\epsilon }{2}-\frac{\epsilon ^2}{8}-\frac{\epsilon ^3}{16}+O\left(\epsilon ^4\right)$$ Make $\epsilon=5 \times 10^{-7}$ and get, for any order of the expansion, the value of $\sqrt{1-\epsilon}$; this will give the values of $x_{\pm}$ to the desired accuracy. For example, if you use the third order, you will get the values with more than $20$ correct decimal places.

$\endgroup$
0
$\begingroup$

There are various approaches. One can say that for the large root, the $2$ is insignificant, so the large root is about $4\times 10^3$. For the small root, $x^2$ is insignificant, so the small root is about $\frac{2}{400\times 10^3}$.

For greater accuracy, find the large root $R$ using the Quadratic Formula. The product of the roots is $2$, so the small root is $\frac{2}{R}$. No loss of significant digits from subtracting two large nearly equal quantities.

Or else (equivalently) for the small root we can use the Citardauq Formula $\frac{2c}{-b\pm \sqrt{b^2-4ac}}$. The small root is equal to $\frac{4}{4\times 10^3 +\sqrt{(4\times 10^3)^2-8}}$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.