0

Let $f(x)= \sqrt{x^2 + 1} - 1$ (taking the positive real square root, as usual). When $a = 10^{−3}$, compute $f(a)$, working to $5$ significant figures at every stage of the calculation.

Also it can be shown (algebraically) that

$$f(x) = \frac{x^{2}}{\sqrt{{x^2}+1}+1}.$$

Use this expression for $f$ to compute $f(a)$, again working to $5$ significant figures at every stage. Which calculation suffers from destructive cancellation?

After calculating I get that in the first case $f(a)=0.$ In the second case $f(a)=0.0000005.$

Jed
  • 589

1 Answers1

0

You have just seen an example of destructive cancellation. If you have $1.0001$ and $1.0000$, these are both five digit numbers. The maximum relative error is about $5E-6$. If you subtract them, you get $0.0001$, which is a single digit number. This happens whenever you subtract two imprecise numbers that are close to each other. Look at the two calculations you did and see where this happens.

Ross Millikan
  • 374,822
  • I still don't quite understand what destructive cancellation is. Could you provide me with another simple example to explain what it is please? – Jed Aug 08 '14 at 15:05
  • I can make another example with different numbers, but it will look just the same. Say $2.0013-2.0005=0.0008$ Again the first two numbers have five digits while the difference has only one. The destructive cancellation is the large common value, here the $2$, that disappears. – Ross Millikan Aug 08 '14 at 15:07
  • Why don't they zeros count as digits in the value 0.0008. – Jed Aug 08 '14 at 15:30
  • Leading zeros after the decimal point do not count as significant digits-they just set the scale. It is like $1000$ has only one significant digit-unless otherwise indicated it is $1000 \pm 500$ as the trailing zeros before the decimal point set the scale. Note that $0.0008$ would be $0.0008 \pm 0.00005$, so there is only one significant digit. – Ross Millikan Aug 08 '14 at 15:37