How to develop a numerical differentiation formula using Taylor expansion/series?

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have a problem understanding a numerical differentiation problem, using Taylor series.



It's an exercise and we should develop a 2nd order approximation formula, which uses just $f(x), f(x-h)$ and $f(x+3h)$. As help, the professor gave us a tip in the exercice, that we should start with:



$$f'(x) = fracaf(x+3h) + bf(x) + cf(x-h) h $$



Attached here is the problem AND the solution (which I think is wrong, or he made something wrong, at least I hope), and a legend for my questions.



exercise



I found other results, and here are my 3 questions:



  1. For point 1 (marked 1 on the screenshot), I found $27/6$ as factor there, not $9/2$

  2. My 2. question (marked 2 in screenshot) concerns the last term in the result. Shouldn't we multiply that big term with $h^3$?

  3. 3rd question (marked 3 in screenshot): Let's say the professor is right, and there are no typos or calculating errors. If we are dividing by $h$, these $h$'s on the nominator will get eliminated by 1 power. So the term (middle term), that he says should be 1, is multiplied by $h$, and if we divide by $h$ there won't be any $h$ anymore there. For the term after if, which is multiplied by $h^2$, and we are dividing by $h$, it will be then just $h$, which makes our formula of 1st order. Or did I understand something wrong?

Thank you for any help! Exam is tomorrow, and I am really freaking out about this.







share|cite|improve this question





















  • thanks for looking up at the question. I tried as stated above, that I found for point 1 for example, on that point 27/6, and for point 2, I multiply the term there with h^3. He doesn't multiply it with nothing. Where are the h^3?
    – ZelelB
    Jul 19 at 17:32










  • 1. $9/2=27/6$ is correct. 2.You forgot the factor $1/h$
    – gammatester
    Jul 19 at 17:38











  • But there is an error in 1: it should read $f'''(x_0)$ not $f'''(0)$.
    – gammatester
    Jul 19 at 17:45










  • you're right for 1, thanks. But for 2, how he forgot 1/h? I am saying he should multiply there with h^3. If you look at the line before, from which he's derivating that line. He is summing the h's, so a term multiplies h, another h^2, and another term multiplies h^3. Or am I wrong. Still don't get it. Where are the h^3 of line before gone? And where is here getting "-9/2" MINUS not +9/2.
    – ZelelB
    Jul 19 at 17:53











  • It should read $Big(frac92 a f'''(x_0)-frac16cf'''(x_0)Big)h^3$
    – gammatester
    Jul 19 at 18:12














up vote
1
down vote

favorite












I have a problem understanding a numerical differentiation problem, using Taylor series.



It's an exercise and we should develop a 2nd order approximation formula, which uses just $f(x), f(x-h)$ and $f(x+3h)$. As help, the professor gave us a tip in the exercice, that we should start with:



$$f'(x) = fracaf(x+3h) + bf(x) + cf(x-h) h $$



Attached here is the problem AND the solution (which I think is wrong, or he made something wrong, at least I hope), and a legend for my questions.



exercise



I found other results, and here are my 3 questions:



  1. For point 1 (marked 1 on the screenshot), I found $27/6$ as factor there, not $9/2$

  2. My 2. question (marked 2 in screenshot) concerns the last term in the result. Shouldn't we multiply that big term with $h^3$?

  3. 3rd question (marked 3 in screenshot): Let's say the professor is right, and there are no typos or calculating errors. If we are dividing by $h$, these $h$'s on the nominator will get eliminated by 1 power. So the term (middle term), that he says should be 1, is multiplied by $h$, and if we divide by $h$ there won't be any $h$ anymore there. For the term after if, which is multiplied by $h^2$, and we are dividing by $h$, it will be then just $h$, which makes our formula of 1st order. Or did I understand something wrong?

Thank you for any help! Exam is tomorrow, and I am really freaking out about this.







share|cite|improve this question





















  • thanks for looking up at the question. I tried as stated above, that I found for point 1 for example, on that point 27/6, and for point 2, I multiply the term there with h^3. He doesn't multiply it with nothing. Where are the h^3?
    – ZelelB
    Jul 19 at 17:32










  • 1. $9/2=27/6$ is correct. 2.You forgot the factor $1/h$
    – gammatester
    Jul 19 at 17:38











  • But there is an error in 1: it should read $f'''(x_0)$ not $f'''(0)$.
    – gammatester
    Jul 19 at 17:45










  • you're right for 1, thanks. But for 2, how he forgot 1/h? I am saying he should multiply there with h^3. If you look at the line before, from which he's derivating that line. He is summing the h's, so a term multiplies h, another h^2, and another term multiplies h^3. Or am I wrong. Still don't get it. Where are the h^3 of line before gone? And where is here getting "-9/2" MINUS not +9/2.
    – ZelelB
    Jul 19 at 17:53











  • It should read $Big(frac92 a f'''(x_0)-frac16cf'''(x_0)Big)h^3$
    – gammatester
    Jul 19 at 18:12












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have a problem understanding a numerical differentiation problem, using Taylor series.



It's an exercise and we should develop a 2nd order approximation formula, which uses just $f(x), f(x-h)$ and $f(x+3h)$. As help, the professor gave us a tip in the exercice, that we should start with:



$$f'(x) = fracaf(x+3h) + bf(x) + cf(x-h) h $$



Attached here is the problem AND the solution (which I think is wrong, or he made something wrong, at least I hope), and a legend for my questions.



exercise



I found other results, and here are my 3 questions:



  1. For point 1 (marked 1 on the screenshot), I found $27/6$ as factor there, not $9/2$

  2. My 2. question (marked 2 in screenshot) concerns the last term in the result. Shouldn't we multiply that big term with $h^3$?

  3. 3rd question (marked 3 in screenshot): Let's say the professor is right, and there are no typos or calculating errors. If we are dividing by $h$, these $h$'s on the nominator will get eliminated by 1 power. So the term (middle term), that he says should be 1, is multiplied by $h$, and if we divide by $h$ there won't be any $h$ anymore there. For the term after if, which is multiplied by $h^2$, and we are dividing by $h$, it will be then just $h$, which makes our formula of 1st order. Or did I understand something wrong?

Thank you for any help! Exam is tomorrow, and I am really freaking out about this.







share|cite|improve this question













I have a problem understanding a numerical differentiation problem, using Taylor series.



It's an exercise and we should develop a 2nd order approximation formula, which uses just $f(x), f(x-h)$ and $f(x+3h)$. As help, the professor gave us a tip in the exercice, that we should start with:



$$f'(x) = fracaf(x+3h) + bf(x) + cf(x-h) h $$



Attached here is the problem AND the solution (which I think is wrong, or he made something wrong, at least I hope), and a legend for my questions.



exercise



I found other results, and here are my 3 questions:



  1. For point 1 (marked 1 on the screenshot), I found $27/6$ as factor there, not $9/2$

  2. My 2. question (marked 2 in screenshot) concerns the last term in the result. Shouldn't we multiply that big term with $h^3$?

  3. 3rd question (marked 3 in screenshot): Let's say the professor is right, and there are no typos or calculating errors. If we are dividing by $h$, these $h$'s on the nominator will get eliminated by 1 power. So the term (middle term), that he says should be 1, is multiplied by $h$, and if we divide by $h$ there won't be any $h$ anymore there. For the term after if, which is multiplied by $h^2$, and we are dividing by $h$, it will be then just $h$, which makes our formula of 1st order. Or did I understand something wrong?

Thank you for any help! Exam is tomorrow, and I am really freaking out about this.









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited Jul 19 at 17:30









Lorenzo B.

1,5402418




1,5402418









asked Jul 19 at 17:15









ZelelB

1256




1256











  • thanks for looking up at the question. I tried as stated above, that I found for point 1 for example, on that point 27/6, and for point 2, I multiply the term there with h^3. He doesn't multiply it with nothing. Where are the h^3?
    – ZelelB
    Jul 19 at 17:32










  • 1. $9/2=27/6$ is correct. 2.You forgot the factor $1/h$
    – gammatester
    Jul 19 at 17:38











  • But there is an error in 1: it should read $f'''(x_0)$ not $f'''(0)$.
    – gammatester
    Jul 19 at 17:45










  • you're right for 1, thanks. But for 2, how he forgot 1/h? I am saying he should multiply there with h^3. If you look at the line before, from which he's derivating that line. He is summing the h's, so a term multiplies h, another h^2, and another term multiplies h^3. Or am I wrong. Still don't get it. Where are the h^3 of line before gone? And where is here getting "-9/2" MINUS not +9/2.
    – ZelelB
    Jul 19 at 17:53











  • It should read $Big(frac92 a f'''(x_0)-frac16cf'''(x_0)Big)h^3$
    – gammatester
    Jul 19 at 18:12
















  • thanks for looking up at the question. I tried as stated above, that I found for point 1 for example, on that point 27/6, and for point 2, I multiply the term there with h^3. He doesn't multiply it with nothing. Where are the h^3?
    – ZelelB
    Jul 19 at 17:32










  • 1. $9/2=27/6$ is correct. 2.You forgot the factor $1/h$
    – gammatester
    Jul 19 at 17:38











  • But there is an error in 1: it should read $f'''(x_0)$ not $f'''(0)$.
    – gammatester
    Jul 19 at 17:45










  • you're right for 1, thanks. But for 2, how he forgot 1/h? I am saying he should multiply there with h^3. If you look at the line before, from which he's derivating that line. He is summing the h's, so a term multiplies h, another h^2, and another term multiplies h^3. Or am I wrong. Still don't get it. Where are the h^3 of line before gone? And where is here getting "-9/2" MINUS not +9/2.
    – ZelelB
    Jul 19 at 17:53











  • It should read $Big(frac92 a f'''(x_0)-frac16cf'''(x_0)Big)h^3$
    – gammatester
    Jul 19 at 18:12















thanks for looking up at the question. I tried as stated above, that I found for point 1 for example, on that point 27/6, and for point 2, I multiply the term there with h^3. He doesn't multiply it with nothing. Where are the h^3?
– ZelelB
Jul 19 at 17:32




thanks for looking up at the question. I tried as stated above, that I found for point 1 for example, on that point 27/6, and for point 2, I multiply the term there with h^3. He doesn't multiply it with nothing. Where are the h^3?
– ZelelB
Jul 19 at 17:32












1. $9/2=27/6$ is correct. 2.You forgot the factor $1/h$
– gammatester
Jul 19 at 17:38





1. $9/2=27/6$ is correct. 2.You forgot the factor $1/h$
– gammatester
Jul 19 at 17:38













But there is an error in 1: it should read $f'''(x_0)$ not $f'''(0)$.
– gammatester
Jul 19 at 17:45




But there is an error in 1: it should read $f'''(x_0)$ not $f'''(0)$.
– gammatester
Jul 19 at 17:45












you're right for 1, thanks. But for 2, how he forgot 1/h? I am saying he should multiply there with h^3. If you look at the line before, from which he's derivating that line. He is summing the h's, so a term multiplies h, another h^2, and another term multiplies h^3. Or am I wrong. Still don't get it. Where are the h^3 of line before gone? And where is here getting "-9/2" MINUS not +9/2.
– ZelelB
Jul 19 at 17:53





you're right for 1, thanks. But for 2, how he forgot 1/h? I am saying he should multiply there with h^3. If you look at the line before, from which he's derivating that line. He is summing the h's, so a term multiplies h, another h^2, and another term multiplies h^3. Or am I wrong. Still don't get it. Where are the h^3 of line before gone? And where is here getting "-9/2" MINUS not +9/2.
– ZelelB
Jul 19 at 17:53













It should read $Big(frac92 a f'''(x_0)-frac16cf'''(x_0)Big)h^3$
– gammatester
Jul 19 at 18:12




It should read $Big(frac92 a f'''(x_0)-frac16cf'''(x_0)Big)h^3$
– gammatester
Jul 19 at 18:12










2 Answers
2






active

oldest

votes

















up vote
2
down vote













1) $frac 276 = frac 92$



2) yes there should be an $h^3$ factor multiplying that term. However, that term ultimately gets dropped (actually becomes the error estimate). And is not relevant for finding optimal values of $a, b, c$



3) yes the $h's$ cancel. That is kind of the point.



$frac 1h [(a+b+c)f(x) + (3a+c)f'(x)h + (frac 92 a + frac 12 c) f''(x)h^2+epsilon h^3] = f'(x)$



Which can only be true if



$(a+b+c) = 0$ and $(3a+c) = 1$



as for $frac 92 a + frac 12 c = 0$ This makes your error term decrease at quadratic speed rather than linear speed.






share|cite|improve this answer





















  • but how does it drop completely? if there were the h^3 (which he forgot to write on the solution), it will be just h^2 (after dividing by h), and not drop completely.. I dont get it :(
    – ZelelB
    Jul 19 at 20:03










  • I thought, it's the most important term! We divide the h^3 by h, so we he h^2, and that's our 2nd order formula, he's looking for
    – ZelelB
    Jul 19 at 20:04

















up vote
1
down vote













More generally,
suppose you want
to find
$f'(x) approx dfracaf(x+uh) + bf(x+vh) + cf(x+wh) h
$.



$f(x+rh)
=f(x)+rhf'(x)+r^2h^2f''(x)/2+r^3h^3f'''(x)/6+O(h^4)
$
so



$beginarray\
af(x+uh) + bf(x+vh) + cf(x+wh)
&=(a+b+c)f(x)+(au+bv+cw)hf'(x)\
&quad +(au^2+bv^2+cw^2)h^2f''(x)/2+(au^3+bv^3+cw^3)h^3f'''(x)/6\
&quad+O(h^4)\
endarray
$



Therefore you want
$0=a+b+c,
1=au+bv+cw,
0=au^2+bv^2+cw^2
$
and the error is
$(au^3+bv^3+cw^3)h^2f'''(x)/6
+O(h^3)
$.



This leads to Vandermonde determinants.



Your case is
$u=3, v=0, w=-1$,
so
$0=a+b+c,
1=3a-c,
0=9a+c
$.



Adding the second and third,
$a=1/12$,
so
$c = -9a
=-3/4$.



From the first,
$b = -a-c
=-1/12+3/4
=2/3
$.



The error coefficient is
$au^3+bv^3+cw^3
=27/12-3/4
=15/12
=5/4
$
so the error is
$(5/4)h^2f'''(x)/6+O(h^3)
=(5/24)h^2f'''(x)+O(h^3)
$.






share|cite|improve this answer





















    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',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    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%2f2856864%2fhow-to-develop-a-numerical-differentiation-formula-using-taylor-expansion-series%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    2
    down vote













    1) $frac 276 = frac 92$



    2) yes there should be an $h^3$ factor multiplying that term. However, that term ultimately gets dropped (actually becomes the error estimate). And is not relevant for finding optimal values of $a, b, c$



    3) yes the $h's$ cancel. That is kind of the point.



    $frac 1h [(a+b+c)f(x) + (3a+c)f'(x)h + (frac 92 a + frac 12 c) f''(x)h^2+epsilon h^3] = f'(x)$



    Which can only be true if



    $(a+b+c) = 0$ and $(3a+c) = 1$



    as for $frac 92 a + frac 12 c = 0$ This makes your error term decrease at quadratic speed rather than linear speed.






    share|cite|improve this answer





















    • but how does it drop completely? if there were the h^3 (which he forgot to write on the solution), it will be just h^2 (after dividing by h), and not drop completely.. I dont get it :(
      – ZelelB
      Jul 19 at 20:03










    • I thought, it's the most important term! We divide the h^3 by h, so we he h^2, and that's our 2nd order formula, he's looking for
      – ZelelB
      Jul 19 at 20:04














    up vote
    2
    down vote













    1) $frac 276 = frac 92$



    2) yes there should be an $h^3$ factor multiplying that term. However, that term ultimately gets dropped (actually becomes the error estimate). And is not relevant for finding optimal values of $a, b, c$



    3) yes the $h's$ cancel. That is kind of the point.



    $frac 1h [(a+b+c)f(x) + (3a+c)f'(x)h + (frac 92 a + frac 12 c) f''(x)h^2+epsilon h^3] = f'(x)$



    Which can only be true if



    $(a+b+c) = 0$ and $(3a+c) = 1$



    as for $frac 92 a + frac 12 c = 0$ This makes your error term decrease at quadratic speed rather than linear speed.






    share|cite|improve this answer





















    • but how does it drop completely? if there were the h^3 (which he forgot to write on the solution), it will be just h^2 (after dividing by h), and not drop completely.. I dont get it :(
      – ZelelB
      Jul 19 at 20:03










    • I thought, it's the most important term! We divide the h^3 by h, so we he h^2, and that's our 2nd order formula, he's looking for
      – ZelelB
      Jul 19 at 20:04












    up vote
    2
    down vote










    up vote
    2
    down vote









    1) $frac 276 = frac 92$



    2) yes there should be an $h^3$ factor multiplying that term. However, that term ultimately gets dropped (actually becomes the error estimate). And is not relevant for finding optimal values of $a, b, c$



    3) yes the $h's$ cancel. That is kind of the point.



    $frac 1h [(a+b+c)f(x) + (3a+c)f'(x)h + (frac 92 a + frac 12 c) f''(x)h^2+epsilon h^3] = f'(x)$



    Which can only be true if



    $(a+b+c) = 0$ and $(3a+c) = 1$



    as for $frac 92 a + frac 12 c = 0$ This makes your error term decrease at quadratic speed rather than linear speed.






    share|cite|improve this answer













    1) $frac 276 = frac 92$



    2) yes there should be an $h^3$ factor multiplying that term. However, that term ultimately gets dropped (actually becomes the error estimate). And is not relevant for finding optimal values of $a, b, c$



    3) yes the $h's$ cancel. That is kind of the point.



    $frac 1h [(a+b+c)f(x) + (3a+c)f'(x)h + (frac 92 a + frac 12 c) f''(x)h^2+epsilon h^3] = f'(x)$



    Which can only be true if



    $(a+b+c) = 0$ and $(3a+c) = 1$



    as for $frac 92 a + frac 12 c = 0$ This makes your error term decrease at quadratic speed rather than linear speed.







    share|cite|improve this answer













    share|cite|improve this answer



    share|cite|improve this answer











    answered Jul 19 at 18:56









    Doug M

    39.2k31749




    39.2k31749











    • but how does it drop completely? if there were the h^3 (which he forgot to write on the solution), it will be just h^2 (after dividing by h), and not drop completely.. I dont get it :(
      – ZelelB
      Jul 19 at 20:03










    • I thought, it's the most important term! We divide the h^3 by h, so we he h^2, and that's our 2nd order formula, he's looking for
      – ZelelB
      Jul 19 at 20:04
















    • but how does it drop completely? if there were the h^3 (which he forgot to write on the solution), it will be just h^2 (after dividing by h), and not drop completely.. I dont get it :(
      – ZelelB
      Jul 19 at 20:03










    • I thought, it's the most important term! We divide the h^3 by h, so we he h^2, and that's our 2nd order formula, he's looking for
      – ZelelB
      Jul 19 at 20:04















    but how does it drop completely? if there were the h^3 (which he forgot to write on the solution), it will be just h^2 (after dividing by h), and not drop completely.. I dont get it :(
    – ZelelB
    Jul 19 at 20:03




    but how does it drop completely? if there were the h^3 (which he forgot to write on the solution), it will be just h^2 (after dividing by h), and not drop completely.. I dont get it :(
    – ZelelB
    Jul 19 at 20:03












    I thought, it's the most important term! We divide the h^3 by h, so we he h^2, and that's our 2nd order formula, he's looking for
    – ZelelB
    Jul 19 at 20:04




    I thought, it's the most important term! We divide the h^3 by h, so we he h^2, and that's our 2nd order formula, he's looking for
    – ZelelB
    Jul 19 at 20:04










    up vote
    1
    down vote













    More generally,
    suppose you want
    to find
    $f'(x) approx dfracaf(x+uh) + bf(x+vh) + cf(x+wh) h
    $.



    $f(x+rh)
    =f(x)+rhf'(x)+r^2h^2f''(x)/2+r^3h^3f'''(x)/6+O(h^4)
    $
    so



    $beginarray\
    af(x+uh) + bf(x+vh) + cf(x+wh)
    &=(a+b+c)f(x)+(au+bv+cw)hf'(x)\
    &quad +(au^2+bv^2+cw^2)h^2f''(x)/2+(au^3+bv^3+cw^3)h^3f'''(x)/6\
    &quad+O(h^4)\
    endarray
    $



    Therefore you want
    $0=a+b+c,
    1=au+bv+cw,
    0=au^2+bv^2+cw^2
    $
    and the error is
    $(au^3+bv^3+cw^3)h^2f'''(x)/6
    +O(h^3)
    $.



    This leads to Vandermonde determinants.



    Your case is
    $u=3, v=0, w=-1$,
    so
    $0=a+b+c,
    1=3a-c,
    0=9a+c
    $.



    Adding the second and third,
    $a=1/12$,
    so
    $c = -9a
    =-3/4$.



    From the first,
    $b = -a-c
    =-1/12+3/4
    =2/3
    $.



    The error coefficient is
    $au^3+bv^3+cw^3
    =27/12-3/4
    =15/12
    =5/4
    $
    so the error is
    $(5/4)h^2f'''(x)/6+O(h^3)
    =(5/24)h^2f'''(x)+O(h^3)
    $.






    share|cite|improve this answer

























      up vote
      1
      down vote













      More generally,
      suppose you want
      to find
      $f'(x) approx dfracaf(x+uh) + bf(x+vh) + cf(x+wh) h
      $.



      $f(x+rh)
      =f(x)+rhf'(x)+r^2h^2f''(x)/2+r^3h^3f'''(x)/6+O(h^4)
      $
      so



      $beginarray\
      af(x+uh) + bf(x+vh) + cf(x+wh)
      &=(a+b+c)f(x)+(au+bv+cw)hf'(x)\
      &quad +(au^2+bv^2+cw^2)h^2f''(x)/2+(au^3+bv^3+cw^3)h^3f'''(x)/6\
      &quad+O(h^4)\
      endarray
      $



      Therefore you want
      $0=a+b+c,
      1=au+bv+cw,
      0=au^2+bv^2+cw^2
      $
      and the error is
      $(au^3+bv^3+cw^3)h^2f'''(x)/6
      +O(h^3)
      $.



      This leads to Vandermonde determinants.



      Your case is
      $u=3, v=0, w=-1$,
      so
      $0=a+b+c,
      1=3a-c,
      0=9a+c
      $.



      Adding the second and third,
      $a=1/12$,
      so
      $c = -9a
      =-3/4$.



      From the first,
      $b = -a-c
      =-1/12+3/4
      =2/3
      $.



      The error coefficient is
      $au^3+bv^3+cw^3
      =27/12-3/4
      =15/12
      =5/4
      $
      so the error is
      $(5/4)h^2f'''(x)/6+O(h^3)
      =(5/24)h^2f'''(x)+O(h^3)
      $.






      share|cite|improve this answer























        up vote
        1
        down vote










        up vote
        1
        down vote









        More generally,
        suppose you want
        to find
        $f'(x) approx dfracaf(x+uh) + bf(x+vh) + cf(x+wh) h
        $.



        $f(x+rh)
        =f(x)+rhf'(x)+r^2h^2f''(x)/2+r^3h^3f'''(x)/6+O(h^4)
        $
        so



        $beginarray\
        af(x+uh) + bf(x+vh) + cf(x+wh)
        &=(a+b+c)f(x)+(au+bv+cw)hf'(x)\
        &quad +(au^2+bv^2+cw^2)h^2f''(x)/2+(au^3+bv^3+cw^3)h^3f'''(x)/6\
        &quad+O(h^4)\
        endarray
        $



        Therefore you want
        $0=a+b+c,
        1=au+bv+cw,
        0=au^2+bv^2+cw^2
        $
        and the error is
        $(au^3+bv^3+cw^3)h^2f'''(x)/6
        +O(h^3)
        $.



        This leads to Vandermonde determinants.



        Your case is
        $u=3, v=0, w=-1$,
        so
        $0=a+b+c,
        1=3a-c,
        0=9a+c
        $.



        Adding the second and third,
        $a=1/12$,
        so
        $c = -9a
        =-3/4$.



        From the first,
        $b = -a-c
        =-1/12+3/4
        =2/3
        $.



        The error coefficient is
        $au^3+bv^3+cw^3
        =27/12-3/4
        =15/12
        =5/4
        $
        so the error is
        $(5/4)h^2f'''(x)/6+O(h^3)
        =(5/24)h^2f'''(x)+O(h^3)
        $.






        share|cite|improve this answer













        More generally,
        suppose you want
        to find
        $f'(x) approx dfracaf(x+uh) + bf(x+vh) + cf(x+wh) h
        $.



        $f(x+rh)
        =f(x)+rhf'(x)+r^2h^2f''(x)/2+r^3h^3f'''(x)/6+O(h^4)
        $
        so



        $beginarray\
        af(x+uh) + bf(x+vh) + cf(x+wh)
        &=(a+b+c)f(x)+(au+bv+cw)hf'(x)\
        &quad +(au^2+bv^2+cw^2)h^2f''(x)/2+(au^3+bv^3+cw^3)h^3f'''(x)/6\
        &quad+O(h^4)\
        endarray
        $



        Therefore you want
        $0=a+b+c,
        1=au+bv+cw,
        0=au^2+bv^2+cw^2
        $
        and the error is
        $(au^3+bv^3+cw^3)h^2f'''(x)/6
        +O(h^3)
        $.



        This leads to Vandermonde determinants.



        Your case is
        $u=3, v=0, w=-1$,
        so
        $0=a+b+c,
        1=3a-c,
        0=9a+c
        $.



        Adding the second and third,
        $a=1/12$,
        so
        $c = -9a
        =-3/4$.



        From the first,
        $b = -a-c
        =-1/12+3/4
        =2/3
        $.



        The error coefficient is
        $au^3+bv^3+cw^3
        =27/12-3/4
        =15/12
        =5/4
        $
        so the error is
        $(5/4)h^2f'''(x)/6+O(h^3)
        =(5/24)h^2f'''(x)+O(h^3)
        $.







        share|cite|improve this answer













        share|cite|improve this answer



        share|cite|improve this answer











        answered Jul 19 at 18:27









        marty cohen

        69.2k446122




        69.2k446122






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2856864%2fhow-to-develop-a-numerical-differentiation-formula-using-taylor-expansion-series%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What is the equation of a 3D cone with generalised tilt?

            Relationship between determinant of matrix and determinant of adjoint?

            Color the edges and diagonals of a regular polygon