Error term with trapezoidal rule

880 Views Asked by At

I have the integral $\int_{0}^{h} e^{x}cos(x) dx$ and then I am asked to find the highest error term for this integral with trapezoidal.

My textbook denotes the highest error term |E| to be $- \frac{h^3}{12}f''(c)$

Since $f''(x)= -2sin(x) e^{x}$

I see that |E| $\leq \frac{(h-0)^3}{12} \cdot |-2sin(x)e^{x}|$

But my problem is I have to if 0 or h gives me the greatest value to find the highest error term. since h (the upper bound) is not a number I'm a little bit confused.

In one way plugging in 0 the value of the term will just be 0. if you plug in h where $h \neq 0$ then you will get something bigger. so I am thinking plugging in h will be the right way to go? (not so mathematically...)

1

There are 1 best solutions below

5
On BEST ANSWER

I think you are confused with the meaning of the expression for the error. What it states is:

There is a point $c$ in the interval $(a, b)$ such that the error in calculating the integral $\int_{a}^bf(x)~{\rm d}x$ using the trapezoid rule is given by the expression $$ \epsilon = (b-a)\frac{h^2}{12}f''(c) \tag{1} $$ here $h$ is the size of the partition.

To give you an example, take $a = 0$, $b= h=1$, and $f(x) = e^{x}\cos x$, using the trapezoidal rule you get

$$ S = \int_0^1{\rm d}f(x) \approx \frac{1}{2}(f(0) + f(1)) = 1.2343 $$

whereas the actual integral is

$$ I = \int_0^1{\rm d}x~f(x) = \frac{1}{2}[-1 + e(\cos 1 + \sin 1)] = 1.37802 $$

The statement above just tells you that there exist a number $c$ in $(0,1)$ such that

$$ -\frac{f''(c)}{12} = 1.37802 - 1.2343 $$

you can actually check this is true, with $c = 0.531375$.

Here is the deal, in most cases we do not know the actual value of the integral, but we can still actually use $(1)$ to put a constraint on the error you are making. For example, in your case

$$ f''(x) = -2e^{x}\sin x $$

So that in the case $a = 0$ and $b = h$ you have

$$ |\epsilon| = \frac{h^3}{12} |2e^{c}2\sin c | = \frac{h^3}{6}e^c|\sin c| \leq \frac{h^3}{6}e^h\sin h \tag {2} $$

where I have used the fact that for $h >0$ small, then $f(x)$ increases, so $f(h) > f(c)$ for $c < h$. End there you have it, you don't know what the actual error you are making, but you know it will never exceed the value in (2)