Finite-difference of the derivative at an arbitrary location

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











up vote
0
down vote

favorite












The second-order, centered-approximation, finite difference of the derivative of $f(x)$ at $x$ is:
$$
f'(x)=frac-f(x-Delta x)+f(x+Delta x)2Delta x
$$
Question: Suppose we have the value of $f'(x)$ throughout our finite-difference grid with grid spacing $Delta x$. Let $f'(x_0)$ be such a value at $x_0$. Is there a way to find $f'(x)$ at an arbitray location between $(x_0-Delta x,x_0+Delta x)$ based on the value of $f'(x_0)$?



Attempt: I tried linearly interpolating the value of $f'(x_0)$ between $(x_0-Delta x,x_0+Delta x)$. However, the result was incorrect.







share|cite|improve this question





















  • What do you mean "the result was incorrect"? What did you do, and what is the correct answer?
    – Andrei
    yesterday










  • Why do you think this is "second order"?
    – David G. Stork
    yesterday










  • @DavidG.Stork Because the error is proportional to $(Delta x)^2$. This is taken from my textbook, too.
    – A Slow Learner
    yesterday










  • So what is a "first order" method? (And $0$th order?)
    – David G. Stork
    yesterday











  • @Andrei The way I performed interpolation is: I let $f'(x)$ at $x_0-Delta x$ to be the maximum value, and $f'(x)$ at $x_0$ to be half the max value. I also assumed that $f'(x)$ is linear between $(x-Delta x_0,x+ Delta x_0)$. I don't know the correct result, but the result that I obtained didn't make sense in a bigger problem that I am working on.
    – A Slow Learner
    yesterday















up vote
0
down vote

favorite












The second-order, centered-approximation, finite difference of the derivative of $f(x)$ at $x$ is:
$$
f'(x)=frac-f(x-Delta x)+f(x+Delta x)2Delta x
$$
Question: Suppose we have the value of $f'(x)$ throughout our finite-difference grid with grid spacing $Delta x$. Let $f'(x_0)$ be such a value at $x_0$. Is there a way to find $f'(x)$ at an arbitray location between $(x_0-Delta x,x_0+Delta x)$ based on the value of $f'(x_0)$?



Attempt: I tried linearly interpolating the value of $f'(x_0)$ between $(x_0-Delta x,x_0+Delta x)$. However, the result was incorrect.







share|cite|improve this question





















  • What do you mean "the result was incorrect"? What did you do, and what is the correct answer?
    – Andrei
    yesterday










  • Why do you think this is "second order"?
    – David G. Stork
    yesterday










  • @DavidG.Stork Because the error is proportional to $(Delta x)^2$. This is taken from my textbook, too.
    – A Slow Learner
    yesterday










  • So what is a "first order" method? (And $0$th order?)
    – David G. Stork
    yesterday











  • @Andrei The way I performed interpolation is: I let $f'(x)$ at $x_0-Delta x$ to be the maximum value, and $f'(x)$ at $x_0$ to be half the max value. I also assumed that $f'(x)$ is linear between $(x-Delta x_0,x+ Delta x_0)$. I don't know the correct result, but the result that I obtained didn't make sense in a bigger problem that I am working on.
    – A Slow Learner
    yesterday













up vote
0
down vote

favorite









up vote
0
down vote

favorite











The second-order, centered-approximation, finite difference of the derivative of $f(x)$ at $x$ is:
$$
f'(x)=frac-f(x-Delta x)+f(x+Delta x)2Delta x
$$
Question: Suppose we have the value of $f'(x)$ throughout our finite-difference grid with grid spacing $Delta x$. Let $f'(x_0)$ be such a value at $x_0$. Is there a way to find $f'(x)$ at an arbitray location between $(x_0-Delta x,x_0+Delta x)$ based on the value of $f'(x_0)$?



Attempt: I tried linearly interpolating the value of $f'(x_0)$ between $(x_0-Delta x,x_0+Delta x)$. However, the result was incorrect.







share|cite|improve this question













The second-order, centered-approximation, finite difference of the derivative of $f(x)$ at $x$ is:
$$
f'(x)=frac-f(x-Delta x)+f(x+Delta x)2Delta x
$$
Question: Suppose we have the value of $f'(x)$ throughout our finite-difference grid with grid spacing $Delta x$. Let $f'(x_0)$ be such a value at $x_0$. Is there a way to find $f'(x)$ at an arbitray location between $(x_0-Delta x,x_0+Delta x)$ based on the value of $f'(x_0)$?



Attempt: I tried linearly interpolating the value of $f'(x_0)$ between $(x_0-Delta x,x_0+Delta x)$. However, the result was incorrect.









share|cite|improve this question












share|cite|improve this question




share|cite|improve this question








edited yesterday









Somos

10.8k1831




10.8k1831









asked yesterday









A Slow Learner

378211




378211











  • What do you mean "the result was incorrect"? What did you do, and what is the correct answer?
    – Andrei
    yesterday










  • Why do you think this is "second order"?
    – David G. Stork
    yesterday










  • @DavidG.Stork Because the error is proportional to $(Delta x)^2$. This is taken from my textbook, too.
    – A Slow Learner
    yesterday










  • So what is a "first order" method? (And $0$th order?)
    – David G. Stork
    yesterday











  • @Andrei The way I performed interpolation is: I let $f'(x)$ at $x_0-Delta x$ to be the maximum value, and $f'(x)$ at $x_0$ to be half the max value. I also assumed that $f'(x)$ is linear between $(x-Delta x_0,x+ Delta x_0)$. I don't know the correct result, but the result that I obtained didn't make sense in a bigger problem that I am working on.
    – A Slow Learner
    yesterday

















  • What do you mean "the result was incorrect"? What did you do, and what is the correct answer?
    – Andrei
    yesterday










  • Why do you think this is "second order"?
    – David G. Stork
    yesterday










  • @DavidG.Stork Because the error is proportional to $(Delta x)^2$. This is taken from my textbook, too.
    – A Slow Learner
    yesterday










  • So what is a "first order" method? (And $0$th order?)
    – David G. Stork
    yesterday











  • @Andrei The way I performed interpolation is: I let $f'(x)$ at $x_0-Delta x$ to be the maximum value, and $f'(x)$ at $x_0$ to be half the max value. I also assumed that $f'(x)$ is linear between $(x-Delta x_0,x+ Delta x_0)$. I don't know the correct result, but the result that I obtained didn't make sense in a bigger problem that I am working on.
    – A Slow Learner
    yesterday
















What do you mean "the result was incorrect"? What did you do, and what is the correct answer?
– Andrei
yesterday




What do you mean "the result was incorrect"? What did you do, and what is the correct answer?
– Andrei
yesterday












Why do you think this is "second order"?
– David G. Stork
yesterday




Why do you think this is "second order"?
– David G. Stork
yesterday












@DavidG.Stork Because the error is proportional to $(Delta x)^2$. This is taken from my textbook, too.
– A Slow Learner
yesterday




@DavidG.Stork Because the error is proportional to $(Delta x)^2$. This is taken from my textbook, too.
– A Slow Learner
yesterday












So what is a "first order" method? (And $0$th order?)
– David G. Stork
yesterday





So what is a "first order" method? (And $0$th order?)
– David G. Stork
yesterday













@Andrei The way I performed interpolation is: I let $f'(x)$ at $x_0-Delta x$ to be the maximum value, and $f'(x)$ at $x_0$ to be half the max value. I also assumed that $f'(x)$ is linear between $(x-Delta x_0,x+ Delta x_0)$. I don't know the correct result, but the result that I obtained didn't make sense in a bigger problem that I am working on.
– A Slow Learner
yesterday





@Andrei The way I performed interpolation is: I let $f'(x)$ at $x_0-Delta x$ to be the maximum value, and $f'(x)$ at $x_0$ to be half the max value. I also assumed that $f'(x)$ is linear between $(x-Delta x_0,x+ Delta x_0)$. I don't know the correct result, but the result that I obtained didn't make sense in a bigger problem that I am working on.
– A Slow Learner
yesterday











1 Answer
1






active

oldest

votes

















up vote
0
down vote













You asked for an approximation to $ f'(x). $ Using simple algebra the answer is
$$ f'(x) approx frac f(x_0+Delta x) - f(x_0-Delta x) 2 Delta x +
2(x - x_0)frac f(x_0+Delta x) - f(x_0) + f(x_0-Delta x) Delta x^2 $$
where the two fractions are approximations to the first and second derivatives of $ f(x) $ at $ x = x_0. $
You can check that when $ f(x) $ is a quadratic polynomial, then the approximation is exact.






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%2f2872564%2ffinite-difference-of-the-derivative-at-an-arbitrary-location%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    You asked for an approximation to $ f'(x). $ Using simple algebra the answer is
    $$ f'(x) approx frac f(x_0+Delta x) - f(x_0-Delta x) 2 Delta x +
    2(x - x_0)frac f(x_0+Delta x) - f(x_0) + f(x_0-Delta x) Delta x^2 $$
    where the two fractions are approximations to the first and second derivatives of $ f(x) $ at $ x = x_0. $
    You can check that when $ f(x) $ is a quadratic polynomial, then the approximation is exact.






    share|cite|improve this answer



























      up vote
      0
      down vote













      You asked for an approximation to $ f'(x). $ Using simple algebra the answer is
      $$ f'(x) approx frac f(x_0+Delta x) - f(x_0-Delta x) 2 Delta x +
      2(x - x_0)frac f(x_0+Delta x) - f(x_0) + f(x_0-Delta x) Delta x^2 $$
      where the two fractions are approximations to the first and second derivatives of $ f(x) $ at $ x = x_0. $
      You can check that when $ f(x) $ is a quadratic polynomial, then the approximation is exact.






      share|cite|improve this answer

























        up vote
        0
        down vote










        up vote
        0
        down vote









        You asked for an approximation to $ f'(x). $ Using simple algebra the answer is
        $$ f'(x) approx frac f(x_0+Delta x) - f(x_0-Delta x) 2 Delta x +
        2(x - x_0)frac f(x_0+Delta x) - f(x_0) + f(x_0-Delta x) Delta x^2 $$
        where the two fractions are approximations to the first and second derivatives of $ f(x) $ at $ x = x_0. $
        You can check that when $ f(x) $ is a quadratic polynomial, then the approximation is exact.






        share|cite|improve this answer















        You asked for an approximation to $ f'(x). $ Using simple algebra the answer is
        $$ f'(x) approx frac f(x_0+Delta x) - f(x_0-Delta x) 2 Delta x +
        2(x - x_0)frac f(x_0+Delta x) - f(x_0) + f(x_0-Delta x) Delta x^2 $$
        where the two fractions are approximations to the first and second derivatives of $ f(x) $ at $ x = x_0. $
        You can check that when $ f(x) $ is a quadratic polynomial, then the approximation is exact.







        share|cite|improve this answer















        share|cite|improve this answer



        share|cite|improve this answer








        edited yesterday


























        answered yesterday









        Somos

        10.8k1831




        10.8k1831






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2872564%2ffinite-difference-of-the-derivative-at-an-arbitrary-location%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?

            Color the edges and diagonals of a regular polygon

            Relationship between determinant of matrix and determinant of adjoint?