from Brian Bradie -Friendly introduction to numerical analysis---- numerical differentiation exercise $$ f'(x_0)=\frac{-2f(x-0-3h)+9f(x_0-2h)-18f(x_0-h)+11f(x_0)}{6h}+\frac14h^3f^{(4)}(\xi) $$

The image shows an example problem that asks to calculate the error bound (totalerror) of a 4 point formula #15 chap6.3.

I know that

total error = maximumroundofferror + truncationerror

the truncation error is given but how does one compute the roundoff error ?

What is the general methodology for solving for roundoff error for 3 point formulas, 4 point formulas, and 5 point formulas

It is fairly straightforward for a two point formula but I cannot translate how to do it for this problem and similar ones

i.e. if have $f '(x_o) = \dfrac{f(x_o+h)-f(x_o-h)}{2h}$ and want to find the total error, I do :

  • a ) let $\tilde f(x_o + h) = fl(f(x_o+h))$, $\tilde f(x0-h)=fl(f(xo-h)$

  • b ) let rounding errors be $\epsilon_1$ and $\epsilon_2$ as in $$ f(x_o+h) - \tilde f(x_o+h) = ϵ_1 \\ f(x_o-h) - \tilde f(x_o-h) = ϵ_2 $$

  • c ) then $$ f '(x_o) = \frac{[\tilde f(x_o+h) + ϵ_1] - [\tilde f(x_o-h)+ϵ_2]}{2h} = (\tilde f(x_o+h) - \tilde f(x_o-h))/2h + (ϵ_1-ϵ_2)/2h $$ since roundoff errors are bounded by machine error epsilon then $|ϵ_1|\le ϵ$ and $|ϵ_2|\le ϵ$ hence $$ |f'(x_o) - (\tilde f(x_o+h)-\tilde f(x_o-h))/2h| \le ϵ/h $$

I am trying to get this same result for the formula in the image but having trouble

please excuse this non formatting as I am a new user and don't have enough points to plug in image of my formatted work.

Any help would be greatly appreciated or a point in the right direction

  • $\begingroup$ What do you mean by "in lieu of epsilon"? "In lieu of" means "instead of," which would make sense if you're not supposed to use anything called "epsilon," but the problem statement says, "roundoff/data errors that are bounded in absolute value by $\epsilon,$" so there's an "epsilon" you can use. $\endgroup$
    – David K
    Jun 3, 2018 at 1:14
  • $\begingroup$ Since you haven't explained how you would have done this if it were a two-point formula, we can't translate your method to four points either. We could, of course, try to guess your method. Someone who has read that exact book might have a better chance to guess correctly. $\endgroup$
    – David K
    Jun 3, 2018 at 1:16
  • $\begingroup$ my apologies for using in lieu that was a grammatical error for the 2 I am posting how I did it for a centralized divided difference formula in my edit ...Thank you $\endgroup$
    – userTron
    Jun 3, 2018 at 1:39
  • $\begingroup$ Regarding the formatting, for what you're doing we generally don't need or want images. You can format all your formulas using the instructions starting here: math.stackexchange.com/help/notation $\endgroup$
    – David K
    Jun 3, 2018 at 14:05
  • $\begingroup$ For example, $$\tilde f(x_0-h)$$ produces $$\tilde f(x_0-h)$$ and $$\frac{\epsilon}{h}$$ produces $$\frac{\epsilon}{h}.$$ $\endgroup$
    – David K
    Jun 3, 2018 at 14:18

2 Answers 2


The exercise seems to want you to do something similar to what you did with $\epsilon_1$ and $\epsilon_2,$ except that since the function is now being evaluated four times instead of two you could use $\epsilon_3$ for the error of the third evaluation and $\epsilon_4$ for the error of the fourth evaluation. Four errors combine in much the same way as two, that is, you take the absolute value of each contribution to the total error (for example, $-2\epsilon_1$ becomes $2\lvert\epsilon_1\rvert$) and then substitute $\epsilon$ for $\lvert\epsilon_i\rvert.$

The following is not really part of the answer, but more like an extended comment:

The question in the book seems a little bit misleading, because in the first part it describes $\epsilon$ as a bound on error, not a bound on relative error, whereas in the second part it sets $\epsilon$ to the "machine epsilon" of an IEEE-754 single-precision number, which introduces a relative error in any calculations whose results are written to IEEE-754 single-precision numbers. Also, as LutzL points out, the error introduced into the output values of such functions by the machine epsilon is not always just the machine epsilon itself, but often is some multiple of machine epsilon as the error accumulates over several internal calculations. Because both the $\epsilon$ in your formulas and "machine epsilon" invoke the word "epsilon," one could easily assume they are the same thing, but they are not.

In other words, the book seems to be trying to give the impression that it is teaching you how to control floating-point errors in a computer, but it is applying the methods incorrectly for that particular application.


The short and sometimes wrong answer is that each function evaluation gives a random error of size $L|f(x_0)|ϵ$, where $L$ is the number of floating point operations in the evaluation of $f$. For the differentiation formula the floating point noise thus sums up to a worst case of size $$\frac{40L|f(x_0)|ϵ}{6h}=\frac{20L|f(x_0)|ϵ}{3h}.$$

This estimate is invalid if critical cancelation takes place during the evaluation of $f$, such as is the case in the evaluation of polynomials close to their roots. Then you would have to replace $f$ by $\bar f$ where each constant is replaced by its absolute value and each subtraction by the addition of same terms.

  • $\begingroup$ I get $2 + 9 + 18 + 11 = 40.$ $\endgroup$
    – David K
    Jun 3, 2018 at 15:43
  • $\begingroup$ Thank you all, so If I am understanding this correctly, If I have the following formula $$f'(x_0)=\frac{ f(x_0-2h) -8f(x_0-h)+8f(x_0+h)-f(x_0+2h)}{12h}$$ then for this differentiation formula, the floating point noise sums up to a worst case of size $$\frac{18L|f(x_0)|epsilon}{12h}$$ $\endgroup$
    – userTron
    Jun 4, 2018 at 3:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .