Riemann Sum Approximations: When are trapezoids more accurate than the middle sum?Which type of Riemann Sum...

Why was the shrinking from 8″ made only to 5.25″ and not smaller (4″ or less)?

What does it mean to describe someone as a butt steak?

Brothers & sisters

Did Shadowfax go to Valinor?

Assassin's bullet with mercury

Why are electrically insulating heatsinks so rare? Is it just cost?

Why can't we play rap on piano?

When a company launches a new product do they "come out" with a new product or do they "come up" with a new product?

Do I have a twin with permutated remainders?

What about the virus in 12 Monkeys?

What is the most common color to indicate the input-field is disabled?

Arrow those variables!

Is it legal for company to use my work email to pretend I still work there?

Western buddy movie with a supernatural twist where a woman turns into an eagle at the end

Is it canonical bit space?

Why is it a bad idea to hire a hitman to eliminate most corrupt politicians?

Doing something right before you need it - expression for this?

AES: Why is it a good practice to use only the first 16bytes of a hash for encryption?

Watching something be written to a file live with tail

Why does Kotter return in Welcome Back Kotter?

If human space travel is limited by the G force vulnerability, is there a way to counter G forces?

Why "Having chlorophyll without photosynthesis is actually very dangerous" and "like living with a bomb"?

Blender 2.8 I can't see vertices, edges or faces in edit mode

Does a druid starting with a bow start with no arrows?



Riemann Sum Approximations: When are trapezoids more accurate than the middle sum?


Which type of Riemann Sum is the most accurate?Similarity between Trapezoidal Sum and Riemann SumsComposite midpoint and trapezoid quadrature of twice differentiable functionRelation between Simpson's Rule, Trapezoid Rule and Midpoint RuleRiemann Integrable Functions SequenceWhy does Trapezoidal Rule have potential error greater than Midpoint?Define the Riemann integral via trapezoids instead of rectanglesFinding $n$ value for trapezoid and midpoint rule errorsWhen calculating riemann sums, which method is more accurate?If the left Riemann sum of a function converges, is the function integrable?Understanding ApproximationSimilarity between Trapezoidal Sum and Riemann Sums













3












$begingroup$


We can approximate a definite integral, $int_a^b f(x)dx$, using a variety of Riemann sums. If $T_n$ and $M_n$ are the nth sums using the trapezoid and midpoint (middle) sum methods and if the second derivative of $f$ is bounded on $[a, b]$ then does the following theorem imply that $M_n$ "tends to be more accurate" then $T_n$?




If $f''$ is continuous on $[a, b]$ and $|f''(x)| leq K$, $forall$ $x in [a, b]$. Then,



$left| int_a^b f(x)dx - T_n right| leq Kfrac{(b-a)^3}{12n^2}$



and



$left| int_a^b f(x)dx - M_n right| leq Kfrac{(b-a)^3}{24n^2}$




For this question let,
$E_{T_n} = left| int_a^b f(x)dx - T_n right| $
and
$E_{M_n} = left| int_a^b f(x)dx - T_n right| $



The theorem is presented (without proof) in a calculus 2 book. It only really seems to imply that, we can with 100% certainly bound E_{M_n} smaller than we can bound E_{T_n}. But, that says nothing about the actual values of E_{T_n} or E_{M_n}.



So, isn't it possible to customize a function so that $E_{T_n} < E_{M_n}$ for a particular n? Could we even make a function so that $E_{T_n} < E_{M_n}$ $forall n$?










share|cite|improve this question











$endgroup$












  • $begingroup$
    For a particular $n$, absolutely: that's equivalent to doing it for $n=1$ and replicating the function across multiple intervals. Just consider any function satisfying $f(0)=f(1)=0$ and $int_0^1 f(x), dx = 0$, but $f(1/2) ne 0$. Then $E_T = 0$ but $E_M$ can be as large as you want (by rescaling $f$).
    $endgroup$
    – Erick Wong
    May 4 '16 at 8:40










  • $begingroup$
    This shows $T = 0$, not $E_T = 0$.
    $endgroup$
    – RRL
    May 5 '16 at 2:20










  • $begingroup$
    Although the Midpoint Rule is typically more accurate, it should be said that the Trapezoid Rule can be used to get $guaranteed$ upper and lower bounds for integrals of concave and convex functions respectively, which cannot be said for the Midpoint Rule.
    $endgroup$
    – Robert Wolfe
    Oct 30 '17 at 15:56
















3












$begingroup$


We can approximate a definite integral, $int_a^b f(x)dx$, using a variety of Riemann sums. If $T_n$ and $M_n$ are the nth sums using the trapezoid and midpoint (middle) sum methods and if the second derivative of $f$ is bounded on $[a, b]$ then does the following theorem imply that $M_n$ "tends to be more accurate" then $T_n$?




If $f''$ is continuous on $[a, b]$ and $|f''(x)| leq K$, $forall$ $x in [a, b]$. Then,



$left| int_a^b f(x)dx - T_n right| leq Kfrac{(b-a)^3}{12n^2}$



and



$left| int_a^b f(x)dx - M_n right| leq Kfrac{(b-a)^3}{24n^2}$




For this question let,
$E_{T_n} = left| int_a^b f(x)dx - T_n right| $
and
$E_{M_n} = left| int_a^b f(x)dx - T_n right| $



The theorem is presented (without proof) in a calculus 2 book. It only really seems to imply that, we can with 100% certainly bound E_{M_n} smaller than we can bound E_{T_n}. But, that says nothing about the actual values of E_{T_n} or E_{M_n}.



So, isn't it possible to customize a function so that $E_{T_n} < E_{M_n}$ for a particular n? Could we even make a function so that $E_{T_n} < E_{M_n}$ $forall n$?










share|cite|improve this question











$endgroup$












  • $begingroup$
    For a particular $n$, absolutely: that's equivalent to doing it for $n=1$ and replicating the function across multiple intervals. Just consider any function satisfying $f(0)=f(1)=0$ and $int_0^1 f(x), dx = 0$, but $f(1/2) ne 0$. Then $E_T = 0$ but $E_M$ can be as large as you want (by rescaling $f$).
    $endgroup$
    – Erick Wong
    May 4 '16 at 8:40










  • $begingroup$
    This shows $T = 0$, not $E_T = 0$.
    $endgroup$
    – RRL
    May 5 '16 at 2:20










  • $begingroup$
    Although the Midpoint Rule is typically more accurate, it should be said that the Trapezoid Rule can be used to get $guaranteed$ upper and lower bounds for integrals of concave and convex functions respectively, which cannot be said for the Midpoint Rule.
    $endgroup$
    – Robert Wolfe
    Oct 30 '17 at 15:56














3












3








3


1



$begingroup$


We can approximate a definite integral, $int_a^b f(x)dx$, using a variety of Riemann sums. If $T_n$ and $M_n$ are the nth sums using the trapezoid and midpoint (middle) sum methods and if the second derivative of $f$ is bounded on $[a, b]$ then does the following theorem imply that $M_n$ "tends to be more accurate" then $T_n$?




If $f''$ is continuous on $[a, b]$ and $|f''(x)| leq K$, $forall$ $x in [a, b]$. Then,



$left| int_a^b f(x)dx - T_n right| leq Kfrac{(b-a)^3}{12n^2}$



and



$left| int_a^b f(x)dx - M_n right| leq Kfrac{(b-a)^3}{24n^2}$




For this question let,
$E_{T_n} = left| int_a^b f(x)dx - T_n right| $
and
$E_{M_n} = left| int_a^b f(x)dx - T_n right| $



The theorem is presented (without proof) in a calculus 2 book. It only really seems to imply that, we can with 100% certainly bound E_{M_n} smaller than we can bound E_{T_n}. But, that says nothing about the actual values of E_{T_n} or E_{M_n}.



So, isn't it possible to customize a function so that $E_{T_n} < E_{M_n}$ for a particular n? Could we even make a function so that $E_{T_n} < E_{M_n}$ $forall n$?










share|cite|improve this question











$endgroup$




We can approximate a definite integral, $int_a^b f(x)dx$, using a variety of Riemann sums. If $T_n$ and $M_n$ are the nth sums using the trapezoid and midpoint (middle) sum methods and if the second derivative of $f$ is bounded on $[a, b]$ then does the following theorem imply that $M_n$ "tends to be more accurate" then $T_n$?




If $f''$ is continuous on $[a, b]$ and $|f''(x)| leq K$, $forall$ $x in [a, b]$. Then,



$left| int_a^b f(x)dx - T_n right| leq Kfrac{(b-a)^3}{12n^2}$



and



$left| int_a^b f(x)dx - M_n right| leq Kfrac{(b-a)^3}{24n^2}$




For this question let,
$E_{T_n} = left| int_a^b f(x)dx - T_n right| $
and
$E_{M_n} = left| int_a^b f(x)dx - T_n right| $



The theorem is presented (without proof) in a calculus 2 book. It only really seems to imply that, we can with 100% certainly bound E_{M_n} smaller than we can bound E_{T_n}. But, that says nothing about the actual values of E_{T_n} or E_{M_n}.



So, isn't it possible to customize a function so that $E_{T_n} < E_{M_n}$ for a particular n? Could we even make a function so that $E_{T_n} < E_{M_n}$ $forall n$?







calculus numerical-methods riemann-sum approximate-integration






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Mar 19 at 4:20









RRL

53.4k52574




53.4k52574










asked May 4 '16 at 7:53









futurebirdfuturebird

3,60412752




3,60412752












  • $begingroup$
    For a particular $n$, absolutely: that's equivalent to doing it for $n=1$ and replicating the function across multiple intervals. Just consider any function satisfying $f(0)=f(1)=0$ and $int_0^1 f(x), dx = 0$, but $f(1/2) ne 0$. Then $E_T = 0$ but $E_M$ can be as large as you want (by rescaling $f$).
    $endgroup$
    – Erick Wong
    May 4 '16 at 8:40










  • $begingroup$
    This shows $T = 0$, not $E_T = 0$.
    $endgroup$
    – RRL
    May 5 '16 at 2:20










  • $begingroup$
    Although the Midpoint Rule is typically more accurate, it should be said that the Trapezoid Rule can be used to get $guaranteed$ upper and lower bounds for integrals of concave and convex functions respectively, which cannot be said for the Midpoint Rule.
    $endgroup$
    – Robert Wolfe
    Oct 30 '17 at 15:56


















  • $begingroup$
    For a particular $n$, absolutely: that's equivalent to doing it for $n=1$ and replicating the function across multiple intervals. Just consider any function satisfying $f(0)=f(1)=0$ and $int_0^1 f(x), dx = 0$, but $f(1/2) ne 0$. Then $E_T = 0$ but $E_M$ can be as large as you want (by rescaling $f$).
    $endgroup$
    – Erick Wong
    May 4 '16 at 8:40










  • $begingroup$
    This shows $T = 0$, not $E_T = 0$.
    $endgroup$
    – RRL
    May 5 '16 at 2:20










  • $begingroup$
    Although the Midpoint Rule is typically more accurate, it should be said that the Trapezoid Rule can be used to get $guaranteed$ upper and lower bounds for integrals of concave and convex functions respectively, which cannot be said for the Midpoint Rule.
    $endgroup$
    – Robert Wolfe
    Oct 30 '17 at 15:56
















$begingroup$
For a particular $n$, absolutely: that's equivalent to doing it for $n=1$ and replicating the function across multiple intervals. Just consider any function satisfying $f(0)=f(1)=0$ and $int_0^1 f(x), dx = 0$, but $f(1/2) ne 0$. Then $E_T = 0$ but $E_M$ can be as large as you want (by rescaling $f$).
$endgroup$
– Erick Wong
May 4 '16 at 8:40




$begingroup$
For a particular $n$, absolutely: that's equivalent to doing it for $n=1$ and replicating the function across multiple intervals. Just consider any function satisfying $f(0)=f(1)=0$ and $int_0^1 f(x), dx = 0$, but $f(1/2) ne 0$. Then $E_T = 0$ but $E_M$ can be as large as you want (by rescaling $f$).
$endgroup$
– Erick Wong
May 4 '16 at 8:40












$begingroup$
This shows $T = 0$, not $E_T = 0$.
$endgroup$
– RRL
May 5 '16 at 2:20




$begingroup$
This shows $T = 0$, not $E_T = 0$.
$endgroup$
– RRL
May 5 '16 at 2:20












$begingroup$
Although the Midpoint Rule is typically more accurate, it should be said that the Trapezoid Rule can be used to get $guaranteed$ upper and lower bounds for integrals of concave and convex functions respectively, which cannot be said for the Midpoint Rule.
$endgroup$
– Robert Wolfe
Oct 30 '17 at 15:56




$begingroup$
Although the Midpoint Rule is typically more accurate, it should be said that the Trapezoid Rule can be used to get $guaranteed$ upper and lower bounds for integrals of concave and convex functions respectively, which cannot be said for the Midpoint Rule.
$endgroup$
– Robert Wolfe
Oct 30 '17 at 15:56










1 Answer
1






active

oldest

votes


















3












$begingroup$

As you observed, the midpoint method is typically more accurate than the trapezoidal method. This is suggested by the composite error bounds, but they don't rule out the possibility that the trapezoidal method might be more accurate in some cases.



We can get a better understanding by examining the local errors for single-segment rules. Consider an interval $[a,b]$ and define interval length $h = b-a$ and midpoint $c = (a+b)/2.$ Note that $b-c = c-a = (b-a)/2 = h/2.$



The midpoint error is



$$E_M = f(c)h - int_a^b f(x) , dx = int_a^b [f(c) - f(x)] , dx.$$



Using a second-order Taylor approximation,



$$f(c) = f(x) + f'(x)(c-x) + frac{1}{2} f''(xi_x)(x-c)^2, $$



we see



$$E_M = -int_a^b f'(x)(x-c) , dx + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



Applying integration by parts to the first integral on the RHS we get



$$int_a^b f'(x)(x-c) = left.(x-c)f(x)right|_a^b - int_a^b f(x) , dx = frac{h}{2}[f(a) + f(b)] - int_a^b f(x) , dx .$$



Note that this result gives us the error $E_T$ for the trapezoidal method.



Hence,



$$E_M = -E_T + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



It is actually not that easy to find examples where $|E_T| < |E_M|$. Using the above result, we can surmise that this could happen when the midpoint method overestimates, $E_M > 0$, the trapezoidal method underestimates $E_T < 0,$ and we have high curvature in a small neighborhood of a point in the interval.



Here is a somewhat contrived example.



Consider the following function that meets those requirements. Note that the second derivative is piecewise continuous but bounded -- which does not degrade the composite $O(n^{-2})$ accuracy.



$$f(x) = begin{cases} 0.25 + 0.75exp(-200 x^2), &mbox{if } -1 leqslant x leqslant 0 \ 0.99 + 0.01 cos(pi x), &mbox{if } ,,,,,,, 0 < x leqslant 1 end{cases}.$$



Then



$$begin{align}int_{-1}^1 f(x) , dx &approx 1.2870\ M &approx 2 \ T &approx 1.2300 \ E_M &approx 0.7130 \ E_T &approx 0.0570 end{align}$$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I think you can use periodic smooth functions to get non-contrived examples.
    $endgroup$
    – Ian
    May 5 '16 at 2:49












Your Answer





StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "69"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
noCode: true, onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1771002%2friemann-sum-approximations-when-are-trapezoids-more-accurate-than-the-middle-su%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









3












$begingroup$

As you observed, the midpoint method is typically more accurate than the trapezoidal method. This is suggested by the composite error bounds, but they don't rule out the possibility that the trapezoidal method might be more accurate in some cases.



We can get a better understanding by examining the local errors for single-segment rules. Consider an interval $[a,b]$ and define interval length $h = b-a$ and midpoint $c = (a+b)/2.$ Note that $b-c = c-a = (b-a)/2 = h/2.$



The midpoint error is



$$E_M = f(c)h - int_a^b f(x) , dx = int_a^b [f(c) - f(x)] , dx.$$



Using a second-order Taylor approximation,



$$f(c) = f(x) + f'(x)(c-x) + frac{1}{2} f''(xi_x)(x-c)^2, $$



we see



$$E_M = -int_a^b f'(x)(x-c) , dx + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



Applying integration by parts to the first integral on the RHS we get



$$int_a^b f'(x)(x-c) = left.(x-c)f(x)right|_a^b - int_a^b f(x) , dx = frac{h}{2}[f(a) + f(b)] - int_a^b f(x) , dx .$$



Note that this result gives us the error $E_T$ for the trapezoidal method.



Hence,



$$E_M = -E_T + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



It is actually not that easy to find examples where $|E_T| < |E_M|$. Using the above result, we can surmise that this could happen when the midpoint method overestimates, $E_M > 0$, the trapezoidal method underestimates $E_T < 0,$ and we have high curvature in a small neighborhood of a point in the interval.



Here is a somewhat contrived example.



Consider the following function that meets those requirements. Note that the second derivative is piecewise continuous but bounded -- which does not degrade the composite $O(n^{-2})$ accuracy.



$$f(x) = begin{cases} 0.25 + 0.75exp(-200 x^2), &mbox{if } -1 leqslant x leqslant 0 \ 0.99 + 0.01 cos(pi x), &mbox{if } ,,,,,,, 0 < x leqslant 1 end{cases}.$$



Then



$$begin{align}int_{-1}^1 f(x) , dx &approx 1.2870\ M &approx 2 \ T &approx 1.2300 \ E_M &approx 0.7130 \ E_T &approx 0.0570 end{align}$$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I think you can use periodic smooth functions to get non-contrived examples.
    $endgroup$
    – Ian
    May 5 '16 at 2:49
















3












$begingroup$

As you observed, the midpoint method is typically more accurate than the trapezoidal method. This is suggested by the composite error bounds, but they don't rule out the possibility that the trapezoidal method might be more accurate in some cases.



We can get a better understanding by examining the local errors for single-segment rules. Consider an interval $[a,b]$ and define interval length $h = b-a$ and midpoint $c = (a+b)/2.$ Note that $b-c = c-a = (b-a)/2 = h/2.$



The midpoint error is



$$E_M = f(c)h - int_a^b f(x) , dx = int_a^b [f(c) - f(x)] , dx.$$



Using a second-order Taylor approximation,



$$f(c) = f(x) + f'(x)(c-x) + frac{1}{2} f''(xi_x)(x-c)^2, $$



we see



$$E_M = -int_a^b f'(x)(x-c) , dx + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



Applying integration by parts to the first integral on the RHS we get



$$int_a^b f'(x)(x-c) = left.(x-c)f(x)right|_a^b - int_a^b f(x) , dx = frac{h}{2}[f(a) + f(b)] - int_a^b f(x) , dx .$$



Note that this result gives us the error $E_T$ for the trapezoidal method.



Hence,



$$E_M = -E_T + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



It is actually not that easy to find examples where $|E_T| < |E_M|$. Using the above result, we can surmise that this could happen when the midpoint method overestimates, $E_M > 0$, the trapezoidal method underestimates $E_T < 0,$ and we have high curvature in a small neighborhood of a point in the interval.



Here is a somewhat contrived example.



Consider the following function that meets those requirements. Note that the second derivative is piecewise continuous but bounded -- which does not degrade the composite $O(n^{-2})$ accuracy.



$$f(x) = begin{cases} 0.25 + 0.75exp(-200 x^2), &mbox{if } -1 leqslant x leqslant 0 \ 0.99 + 0.01 cos(pi x), &mbox{if } ,,,,,,, 0 < x leqslant 1 end{cases}.$$



Then



$$begin{align}int_{-1}^1 f(x) , dx &approx 1.2870\ M &approx 2 \ T &approx 1.2300 \ E_M &approx 0.7130 \ E_T &approx 0.0570 end{align}$$






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I think you can use periodic smooth functions to get non-contrived examples.
    $endgroup$
    – Ian
    May 5 '16 at 2:49














3












3








3





$begingroup$

As you observed, the midpoint method is typically more accurate than the trapezoidal method. This is suggested by the composite error bounds, but they don't rule out the possibility that the trapezoidal method might be more accurate in some cases.



We can get a better understanding by examining the local errors for single-segment rules. Consider an interval $[a,b]$ and define interval length $h = b-a$ and midpoint $c = (a+b)/2.$ Note that $b-c = c-a = (b-a)/2 = h/2.$



The midpoint error is



$$E_M = f(c)h - int_a^b f(x) , dx = int_a^b [f(c) - f(x)] , dx.$$



Using a second-order Taylor approximation,



$$f(c) = f(x) + f'(x)(c-x) + frac{1}{2} f''(xi_x)(x-c)^2, $$



we see



$$E_M = -int_a^b f'(x)(x-c) , dx + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



Applying integration by parts to the first integral on the RHS we get



$$int_a^b f'(x)(x-c) = left.(x-c)f(x)right|_a^b - int_a^b f(x) , dx = frac{h}{2}[f(a) + f(b)] - int_a^b f(x) , dx .$$



Note that this result gives us the error $E_T$ for the trapezoidal method.



Hence,



$$E_M = -E_T + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



It is actually not that easy to find examples where $|E_T| < |E_M|$. Using the above result, we can surmise that this could happen when the midpoint method overestimates, $E_M > 0$, the trapezoidal method underestimates $E_T < 0,$ and we have high curvature in a small neighborhood of a point in the interval.



Here is a somewhat contrived example.



Consider the following function that meets those requirements. Note that the second derivative is piecewise continuous but bounded -- which does not degrade the composite $O(n^{-2})$ accuracy.



$$f(x) = begin{cases} 0.25 + 0.75exp(-200 x^2), &mbox{if } -1 leqslant x leqslant 0 \ 0.99 + 0.01 cos(pi x), &mbox{if } ,,,,,,, 0 < x leqslant 1 end{cases}.$$



Then



$$begin{align}int_{-1}^1 f(x) , dx &approx 1.2870\ M &approx 2 \ T &approx 1.2300 \ E_M &approx 0.7130 \ E_T &approx 0.0570 end{align}$$






share|cite|improve this answer











$endgroup$



As you observed, the midpoint method is typically more accurate than the trapezoidal method. This is suggested by the composite error bounds, but they don't rule out the possibility that the trapezoidal method might be more accurate in some cases.



We can get a better understanding by examining the local errors for single-segment rules. Consider an interval $[a,b]$ and define interval length $h = b-a$ and midpoint $c = (a+b)/2.$ Note that $b-c = c-a = (b-a)/2 = h/2.$



The midpoint error is



$$E_M = f(c)h - int_a^b f(x) , dx = int_a^b [f(c) - f(x)] , dx.$$



Using a second-order Taylor approximation,



$$f(c) = f(x) + f'(x)(c-x) + frac{1}{2} f''(xi_x)(x-c)^2, $$



we see



$$E_M = -int_a^b f'(x)(x-c) , dx + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



Applying integration by parts to the first integral on the RHS we get



$$int_a^b f'(x)(x-c) = left.(x-c)f(x)right|_a^b - int_a^b f(x) , dx = frac{h}{2}[f(a) + f(b)] - int_a^b f(x) , dx .$$



Note that this result gives us the error $E_T$ for the trapezoidal method.



Hence,



$$E_M = -E_T + frac{1}{2}int_a^b f''(xi_x)(x-c)^2 , dx.$$



It is actually not that easy to find examples where $|E_T| < |E_M|$. Using the above result, we can surmise that this could happen when the midpoint method overestimates, $E_M > 0$, the trapezoidal method underestimates $E_T < 0,$ and we have high curvature in a small neighborhood of a point in the interval.



Here is a somewhat contrived example.



Consider the following function that meets those requirements. Note that the second derivative is piecewise continuous but bounded -- which does not degrade the composite $O(n^{-2})$ accuracy.



$$f(x) = begin{cases} 0.25 + 0.75exp(-200 x^2), &mbox{if } -1 leqslant x leqslant 0 \ 0.99 + 0.01 cos(pi x), &mbox{if } ,,,,,,, 0 < x leqslant 1 end{cases}.$$



Then



$$begin{align}int_{-1}^1 f(x) , dx &approx 1.2870\ M &approx 2 \ T &approx 1.2300 \ E_M &approx 0.7130 \ E_T &approx 0.0570 end{align}$$







share|cite|improve this answer














share|cite|improve this answer



share|cite|improve this answer








edited May 5 '16 at 2:32

























answered May 5 '16 at 2:18









RRLRRL

53.4k52574




53.4k52574












  • $begingroup$
    I think you can use periodic smooth functions to get non-contrived examples.
    $endgroup$
    – Ian
    May 5 '16 at 2:49


















  • $begingroup$
    I think you can use periodic smooth functions to get non-contrived examples.
    $endgroup$
    – Ian
    May 5 '16 at 2:49
















$begingroup$
I think you can use periodic smooth functions to get non-contrived examples.
$endgroup$
– Ian
May 5 '16 at 2:49




$begingroup$
I think you can use periodic smooth functions to get non-contrived examples.
$endgroup$
– Ian
May 5 '16 at 2:49


















draft saved

draft discarded




















































Thanks for contributing an answer to Mathematics Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


Use MathJax to format equations. MathJax reference.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1771002%2friemann-sum-approximations-when-are-trapezoids-more-accurate-than-the-middle-su%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Nidaros erkebispedøme

Birsay

Was Woodrow Wilson really a Liberal?Was World War I a war of liberals against authoritarians?Founding Fathers...