Trapezoid rule error












1












$begingroup$


I am trying to compute the error in the trapezoid rule integration for a function $f(x)$
in the interval $[a,b]$.



I believe I have to Taylor-expand $f(x)$ around $x=a$



$f(a) + (x-a)f'(a)+ 1/2 (x-a)^2 f''(a) + ...$



and then do the integral of this, to later use it when comparing with the trapezoid rule:



$(b-a) (f(b) + f(a))/2$



However I am stuck on the integration of the Taylor expansion and on how to deduct from this the trapezoid approximation.



Can someone give me a hint on how to proceed? Thanks.










share|cite|improve this question











$endgroup$

















    1












    $begingroup$


    I am trying to compute the error in the trapezoid rule integration for a function $f(x)$
    in the interval $[a,b]$.



    I believe I have to Taylor-expand $f(x)$ around $x=a$



    $f(a) + (x-a)f'(a)+ 1/2 (x-a)^2 f''(a) + ...$



    and then do the integral of this, to later use it when comparing with the trapezoid rule:



    $(b-a) (f(b) + f(a))/2$



    However I am stuck on the integration of the Taylor expansion and on how to deduct from this the trapezoid approximation.



    Can someone give me a hint on how to proceed? Thanks.










    share|cite|improve this question











    $endgroup$















      1












      1








      1





      $begingroup$


      I am trying to compute the error in the trapezoid rule integration for a function $f(x)$
      in the interval $[a,b]$.



      I believe I have to Taylor-expand $f(x)$ around $x=a$



      $f(a) + (x-a)f'(a)+ 1/2 (x-a)^2 f''(a) + ...$



      and then do the integral of this, to later use it when comparing with the trapezoid rule:



      $(b-a) (f(b) + f(a))/2$



      However I am stuck on the integration of the Taylor expansion and on how to deduct from this the trapezoid approximation.



      Can someone give me a hint on how to proceed? Thanks.










      share|cite|improve this question











      $endgroup$




      I am trying to compute the error in the trapezoid rule integration for a function $f(x)$
      in the interval $[a,b]$.



      I believe I have to Taylor-expand $f(x)$ around $x=a$



      $f(a) + (x-a)f'(a)+ 1/2 (x-a)^2 f''(a) + ...$



      and then do the integral of this, to later use it when comparing with the trapezoid rule:



      $(b-a) (f(b) + f(a))/2$



      However I am stuck on the integration of the Taylor expansion and on how to deduct from this the trapezoid approximation.



      Can someone give me a hint on how to proceed? Thanks.







      integration taylor-expansion






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Feb 18 '16 at 22:05







      Estefy

















      asked Feb 18 '16 at 21:46









      EstefyEstefy

      64




      64






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          Estimating the error with the Taylor expansion is quite messy.



          For an alternative, consider the local error on a subinterval $[x_n, x_{n+1}]$ with $h = x_{n+1} - x_n$.



          The error in approximating the integral with the trapezoidal formula is



          $$E_n = frac{h}{2}[f(x_n) + f(x_{n+1})] - int_{x_n}^{x_{n+1}} f(x) , dx.$$



          Integration by parts shows this to be



          $$E_n = int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx,$$



          where $c = (x_{n+1}+x_n)/2$ is the midpoint.



          To see this, note that



          $$x_{n+1} - c = c - x_n = frac{x_{n+1} - x_n}{2} = frac{h}{2},$$



          and with $u = (x-c)$ and $dv = f'(x)dx$, integration by parts yields



          $$int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx = (x-c)f(x)|_{x_n}^{x_{n+1}} - int_{x_n}^{x_{n+1}} f(x) , dx = E_n.$$



          If the derivative is bounded as $|f'(x)| leqslant M$, we can bound the error as



          $$|E_n| leqslant int_{x_n}^{x_{n+1}}|x-c||f'(x)| , dx \ leqslant Mint_{x_n}^{x_{n+1}}|x-c| , dx \ = frac{M}{4}(x_{n+1} - x_n)^2 \ = frac{M}{4}h^2.$$



          Approximating the integral over $[a,b]$ with $m$ subintervals of length $h = (b-a)/m$, has a global error bound of



          $$|GE| leqslant sum_{n=1}^{m} |E_n| = mfrac{M}{4}h^2 = frac{M(b-a)^2}{4m}$$



          If the second derivative is bounded as $|f''(x)| leqslant M$, then we can demonstrate $O(h^3)$ local accuracy. An integration by parts of the previous integral for $E_n$ yields



          $$E_n = frac1{2} int_{x_n}^{x_{n+1}} [(h/2)^2 - (x-c)^2]f''(x) , dx.$$



          Using the bound for $f''$ and integrating we obtain the local and global error bounds



          $$|E_n| leqslant frac{M}{12}h^3, \ |GE| leqslant frac{M(b-a)^3}{12m^2}.$$






          share|cite|improve this answer











          $endgroup$













            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%2f1662083%2ftrapezoid-rule-error%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









            0












            $begingroup$

            Estimating the error with the Taylor expansion is quite messy.



            For an alternative, consider the local error on a subinterval $[x_n, x_{n+1}]$ with $h = x_{n+1} - x_n$.



            The error in approximating the integral with the trapezoidal formula is



            $$E_n = frac{h}{2}[f(x_n) + f(x_{n+1})] - int_{x_n}^{x_{n+1}} f(x) , dx.$$



            Integration by parts shows this to be



            $$E_n = int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx,$$



            where $c = (x_{n+1}+x_n)/2$ is the midpoint.



            To see this, note that



            $$x_{n+1} - c = c - x_n = frac{x_{n+1} - x_n}{2} = frac{h}{2},$$



            and with $u = (x-c)$ and $dv = f'(x)dx$, integration by parts yields



            $$int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx = (x-c)f(x)|_{x_n}^{x_{n+1}} - int_{x_n}^{x_{n+1}} f(x) , dx = E_n.$$



            If the derivative is bounded as $|f'(x)| leqslant M$, we can bound the error as



            $$|E_n| leqslant int_{x_n}^{x_{n+1}}|x-c||f'(x)| , dx \ leqslant Mint_{x_n}^{x_{n+1}}|x-c| , dx \ = frac{M}{4}(x_{n+1} - x_n)^2 \ = frac{M}{4}h^2.$$



            Approximating the integral over $[a,b]$ with $m$ subintervals of length $h = (b-a)/m$, has a global error bound of



            $$|GE| leqslant sum_{n=1}^{m} |E_n| = mfrac{M}{4}h^2 = frac{M(b-a)^2}{4m}$$



            If the second derivative is bounded as $|f''(x)| leqslant M$, then we can demonstrate $O(h^3)$ local accuracy. An integration by parts of the previous integral for $E_n$ yields



            $$E_n = frac1{2} int_{x_n}^{x_{n+1}} [(h/2)^2 - (x-c)^2]f''(x) , dx.$$



            Using the bound for $f''$ and integrating we obtain the local and global error bounds



            $$|E_n| leqslant frac{M}{12}h^3, \ |GE| leqslant frac{M(b-a)^3}{12m^2}.$$






            share|cite|improve this answer











            $endgroup$


















              0












              $begingroup$

              Estimating the error with the Taylor expansion is quite messy.



              For an alternative, consider the local error on a subinterval $[x_n, x_{n+1}]$ with $h = x_{n+1} - x_n$.



              The error in approximating the integral with the trapezoidal formula is



              $$E_n = frac{h}{2}[f(x_n) + f(x_{n+1})] - int_{x_n}^{x_{n+1}} f(x) , dx.$$



              Integration by parts shows this to be



              $$E_n = int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx,$$



              where $c = (x_{n+1}+x_n)/2$ is the midpoint.



              To see this, note that



              $$x_{n+1} - c = c - x_n = frac{x_{n+1} - x_n}{2} = frac{h}{2},$$



              and with $u = (x-c)$ and $dv = f'(x)dx$, integration by parts yields



              $$int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx = (x-c)f(x)|_{x_n}^{x_{n+1}} - int_{x_n}^{x_{n+1}} f(x) , dx = E_n.$$



              If the derivative is bounded as $|f'(x)| leqslant M$, we can bound the error as



              $$|E_n| leqslant int_{x_n}^{x_{n+1}}|x-c||f'(x)| , dx \ leqslant Mint_{x_n}^{x_{n+1}}|x-c| , dx \ = frac{M}{4}(x_{n+1} - x_n)^2 \ = frac{M}{4}h^2.$$



              Approximating the integral over $[a,b]$ with $m$ subintervals of length $h = (b-a)/m$, has a global error bound of



              $$|GE| leqslant sum_{n=1}^{m} |E_n| = mfrac{M}{4}h^2 = frac{M(b-a)^2}{4m}$$



              If the second derivative is bounded as $|f''(x)| leqslant M$, then we can demonstrate $O(h^3)$ local accuracy. An integration by parts of the previous integral for $E_n$ yields



              $$E_n = frac1{2} int_{x_n}^{x_{n+1}} [(h/2)^2 - (x-c)^2]f''(x) , dx.$$



              Using the bound for $f''$ and integrating we obtain the local and global error bounds



              $$|E_n| leqslant frac{M}{12}h^3, \ |GE| leqslant frac{M(b-a)^3}{12m^2}.$$






              share|cite|improve this answer











              $endgroup$
















                0












                0








                0





                $begingroup$

                Estimating the error with the Taylor expansion is quite messy.



                For an alternative, consider the local error on a subinterval $[x_n, x_{n+1}]$ with $h = x_{n+1} - x_n$.



                The error in approximating the integral with the trapezoidal formula is



                $$E_n = frac{h}{2}[f(x_n) + f(x_{n+1})] - int_{x_n}^{x_{n+1}} f(x) , dx.$$



                Integration by parts shows this to be



                $$E_n = int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx,$$



                where $c = (x_{n+1}+x_n)/2$ is the midpoint.



                To see this, note that



                $$x_{n+1} - c = c - x_n = frac{x_{n+1} - x_n}{2} = frac{h}{2},$$



                and with $u = (x-c)$ and $dv = f'(x)dx$, integration by parts yields



                $$int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx = (x-c)f(x)|_{x_n}^{x_{n+1}} - int_{x_n}^{x_{n+1}} f(x) , dx = E_n.$$



                If the derivative is bounded as $|f'(x)| leqslant M$, we can bound the error as



                $$|E_n| leqslant int_{x_n}^{x_{n+1}}|x-c||f'(x)| , dx \ leqslant Mint_{x_n}^{x_{n+1}}|x-c| , dx \ = frac{M}{4}(x_{n+1} - x_n)^2 \ = frac{M}{4}h^2.$$



                Approximating the integral over $[a,b]$ with $m$ subintervals of length $h = (b-a)/m$, has a global error bound of



                $$|GE| leqslant sum_{n=1}^{m} |E_n| = mfrac{M}{4}h^2 = frac{M(b-a)^2}{4m}$$



                If the second derivative is bounded as $|f''(x)| leqslant M$, then we can demonstrate $O(h^3)$ local accuracy. An integration by parts of the previous integral for $E_n$ yields



                $$E_n = frac1{2} int_{x_n}^{x_{n+1}} [(h/2)^2 - (x-c)^2]f''(x) , dx.$$



                Using the bound for $f''$ and integrating we obtain the local and global error bounds



                $$|E_n| leqslant frac{M}{12}h^3, \ |GE| leqslant frac{M(b-a)^3}{12m^2}.$$






                share|cite|improve this answer











                $endgroup$



                Estimating the error with the Taylor expansion is quite messy.



                For an alternative, consider the local error on a subinterval $[x_n, x_{n+1}]$ with $h = x_{n+1} - x_n$.



                The error in approximating the integral with the trapezoidal formula is



                $$E_n = frac{h}{2}[f(x_n) + f(x_{n+1})] - int_{x_n}^{x_{n+1}} f(x) , dx.$$



                Integration by parts shows this to be



                $$E_n = int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx,$$



                where $c = (x_{n+1}+x_n)/2$ is the midpoint.



                To see this, note that



                $$x_{n+1} - c = c - x_n = frac{x_{n+1} - x_n}{2} = frac{h}{2},$$



                and with $u = (x-c)$ and $dv = f'(x)dx$, integration by parts yields



                $$int_{x_n}^{x_{n+1}}(x-c)f'(x) , dx = (x-c)f(x)|_{x_n}^{x_{n+1}} - int_{x_n}^{x_{n+1}} f(x) , dx = E_n.$$



                If the derivative is bounded as $|f'(x)| leqslant M$, we can bound the error as



                $$|E_n| leqslant int_{x_n}^{x_{n+1}}|x-c||f'(x)| , dx \ leqslant Mint_{x_n}^{x_{n+1}}|x-c| , dx \ = frac{M}{4}(x_{n+1} - x_n)^2 \ = frac{M}{4}h^2.$$



                Approximating the integral over $[a,b]$ with $m$ subintervals of length $h = (b-a)/m$, has a global error bound of



                $$|GE| leqslant sum_{n=1}^{m} |E_n| = mfrac{M}{4}h^2 = frac{M(b-a)^2}{4m}$$



                If the second derivative is bounded as $|f''(x)| leqslant M$, then we can demonstrate $O(h^3)$ local accuracy. An integration by parts of the previous integral for $E_n$ yields



                $$E_n = frac1{2} int_{x_n}^{x_{n+1}} [(h/2)^2 - (x-c)^2]f''(x) , dx.$$



                Using the bound for $f''$ and integrating we obtain the local and global error bounds



                $$|E_n| leqslant frac{M}{12}h^3, \ |GE| leqslant frac{M(b-a)^3}{12m^2}.$$







                share|cite|improve this answer














                share|cite|improve this answer



                share|cite|improve this answer








                edited Feb 19 '16 at 4:04

























                answered Feb 18 '16 at 22:18









                RRLRRL

                51.5k42573




                51.5k42573






























                    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%2f1662083%2ftrapezoid-rule-error%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

                    Quarter-circle Tiles

                    build a pushdown automaton that recognizes the reverse language of a given pushdown automaton?

                    Mont Emei