0

Suppose we want to calculate, $$0.2-0.8\times \frac{4-1.41^2}{20}$$If I use the approximation $1.41\approx\sqrt2$ the above expression will be equal to $0.12$. I'm wondering how to estimate maximum possible error we have made by using this approximation? I'm trying to use numerical methods here. Assume we know $\sqrt2=1.41\ldots$ (not knowing the number after $1$ should be $4$) than maximum error will be $0.00\bar9=0.01$. But I'm not sure how to use $0.01$ to find maximum error in $0.2-0.8\times \frac{4-1.41^2}{20}$.

Etemon
  • 6,437

2 Answers2

2

This is what calculus is for.

Say $f(t)=\frac{t^2}{20}$. Then $f'(t)=\frac t{10}$. If $f$ is differentiable and $h$ is small enough then $$f(x+h)-f(x)\approx hf'(x)$$is a "good" approximation for the difference of $f$ at two points. (How good? As good as you want if $h$ is small enough... )

Let $x=1.41$ and $h=\sqrt 2-1.41$. Then $|h|\le0.01$, so a reasonable bound on $|f(\sqrt 2)-f(1.41)|$ should be $$|hf'(x)|\le0.01\frac1{10}=0.001.$$

Probably more or less, assuming that $h$ is in fact "small enough". For a rigorous version of the inequality you can use Taylor's Theorem with $n=1$.

  • Thanks for the answer! I think to determine how good the approximation is, the function is also important. For example by comparing graph of $f(x)=x^{9}$ and $g(x)=x^{-9}$ at the point $(0,0)$ we have a better approximation for the first one. – Etemon Jan 16 '22 at 23:27
  • 1
    @Etemon Of course the function is important. What's above is very sloppy, the sort of approximation you do in your head. The "error term" in Taylor's Theorem gives an upper bound on the size of the error above, and of course that error term depends on $f$. (But even though I haven't proved it I bet that the error the OP was asking about is in fact less than $0.001$.) – David C. Ullrich Jan 16 '22 at 23:31
  • @Etemon (Btw not that it matters, but there's no such thing as the graph of $g(t)=t^{-9}$ "at the point $(0,0)$".) – David C. Ullrich Jan 16 '22 at 23:35
  • It is clear now. And yes I chose a bad example :) – Etemon Jan 16 '22 at 23:37
1

You can use straightforward interval arithmetic here. Let $X = [1.41, \sqrt{2}]$ be your uncertain variable; inject it into $f(x) = 0.2 - 0.8 \frac{4 - x^2}{20} = 0.2 - 0.04 (4 - x^2)$.
We get:
$f(X) = 0.2 - 0.04 (4 - X^2) \\ = 0.2 - 0.04 (4 - [1.41, \sqrt{2}]^2) \\ = 0.2 - 0.04 (4 - [1.9881, 2]) \\ = 0.2 - 0.04 [2, 2.0119] \\ = 0.2 - [0.08, 0.080476] \\ = [0.119524, 0.12]$.

This gives you the uncertainty on the result for the given uncertainty in $x$.

Note: this works well because there's only one occurrence of $x$ in the expression of $f$. See here.

Charlie Vanaret
  • 922
  • 6
  • 9
  • I think the point was to avoid calculations like $1.41^2$. – David C. Ullrich Jan 17 '22 at 14:42
  • Of course the question is why/whether $f([a,b])=[f(a), f(b)]$. You and Wikipedia say this is ok if $f$ is continuous and $x$ appears only once. So what about $f(x)=\sin(x)$, $[a,b]=[0,2\pi]$? – David C. Ullrich Jan 17 '22 at 16:03
  • Interval arithmetic libraries guarantee a reliable enclosure ;) A Julia example:
    julia> using IntervalArithmetic

    julia> sin(0..2*pi) The answer is [-1, 1]. If you have several occurrences of the variables, you may get an overestimation.

    – Charlie Vanaret Jan 18 '22 at 09:15