# Thread: Numerical Analysis - Relative Error

1. ## 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

2. ## Re: Numerical Analysis - Relative Error

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.

3. ## Re: Numerical Analysis - Relative Error

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$