# Numerical Analysis - Relative Error

• Oct 23rd 2011, 10:46 AM
jnava
Numerical Analysis - Relative Error
Hi, I am working on the following problem and need some assistance:

For what range of values of x will the computed value of f(x) given below have large relative error? Assume 0 $\le$ x $\le$ 100

f(x) = 10 - $\sqrt{(100-x)}$

I know that catostrophic error can occur when subtracting two numbers of similar magnitude, so in our case would we present the most relative error when x is equal to 0 and 100? Or do I need a wider range of numbers?

Thanks
• Oct 23rd 2011, 11:49 AM
SammyS
Re: Numerical Analysis - Relative Error
Quote:

Originally Posted by jnava
Hi, I am working on the following problem and need some assistance:

For what range of values of x will the computed value of f(x) given below have large relative error? Assume 0 $\le$ x $\le$ 100

f(x) = 10 - $\sqrt{(100-x)}$

I know that catastrophic error can occur when subtracting two numbers of similar magnitude, so in our case would we present the most relative error when x is equal to 0 and 100? Or do I need a wider range of numbers?

Thanks

Assume some reasonable relative error for the square root operation. See what happens for x1 which is close to 100, like 100 minus a few times the relative error times 100. Then see what happens with x2 = 100 - x1, which is a number close to zero.
• Nov 4th 2011, 11:24 AM
chisigma
Re: Numerical Analysis - Relative Error
Quote:

Originally Posted by jnava
Hi, I am working on the following problem and need some assistance:

For what range of values of x will the computed value of f(x) given below have large relative error? Assume 0 $\le$ x $\le$ 100

f(x) = 10 - $\sqrt{(100-x)}$

I know that catostrophic error can occur when subtracting two numbers of similar magnitude, so in our case would we present the most relative error when x is equal to 0 and 100? Or do I need a wider range of numbers?

Thanks

With a simple step You obtain...

$f(x)= 10- \sqrt{100-x} = \frac{x}{10+\sqrt{100-x}}$ (1)

... and any criticity disappears. In particular for 'small' values of x is $f(x) \sim \frac{x}{20}$...

Kind regards

$\chi$ $\sigma$