how to solve $x''=f(x)$ numerically?

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











up vote
2
down vote

favorite
1












I know how to solve when $f(x)$ is linear, but how to solve the equation $x''=f(x)$ with $f$ a unknown nonlinear function using numerical methods?



Any references would be helpful. Thanks!



Update: Sorry that I am not clear about it, what I mean is the exact form of $f$ is unknown, but you can think it as a black box and you can get values at any points from $f$.







share|cite|improve this question


















  • 1




    If $f$ is truly unknown, you're somewhat dead in the water with respect to numerical methods. You can do $(x')^2/2=int f(x),x',dt=int f(x),dx,$ for a single formal integration, but that's about as far as you can get.
    – Adrian Keister
    Aug 27 at 18:36







  • 1




    Perhaps instead of saying an "unknown" function, one may ask about a "black box" function $f$, i.e. the internal details are unknown but we can evaluate it at any point.
    – hardmath
    Aug 27 at 18:55






  • 1




    I think you need to clarify what you mean by "unknown". As written, this is like asking "How can you solve an equation when you don't know what is on the right-hand side?" The obvious answer is you can't.
    – mweiss
    Aug 27 at 19:07










  • I think that, with high probability, Sherry really means "a general nonlinear function" rather than "a unknown nonlinear function." Indeed Sherry is contrasting to the "linear function" case, for which "general nonlinear function" seems to be the most appropriate opposite case. So, the answer that was (unfortunately) deleted was likely the answer being sought by the asker.
    – Michael
    Aug 27 at 19:46















up vote
2
down vote

favorite
1












I know how to solve when $f(x)$ is linear, but how to solve the equation $x''=f(x)$ with $f$ a unknown nonlinear function using numerical methods?



Any references would be helpful. Thanks!



Update: Sorry that I am not clear about it, what I mean is the exact form of $f$ is unknown, but you can think it as a black box and you can get values at any points from $f$.







share|cite|improve this question


















  • 1




    If $f$ is truly unknown, you're somewhat dead in the water with respect to numerical methods. You can do $(x')^2/2=int f(x),x',dt=int f(x),dx,$ for a single formal integration, but that's about as far as you can get.
    – Adrian Keister
    Aug 27 at 18:36







  • 1




    Perhaps instead of saying an "unknown" function, one may ask about a "black box" function $f$, i.e. the internal details are unknown but we can evaluate it at any point.
    – hardmath
    Aug 27 at 18:55






  • 1




    I think you need to clarify what you mean by "unknown". As written, this is like asking "How can you solve an equation when you don't know what is on the right-hand side?" The obvious answer is you can't.
    – mweiss
    Aug 27 at 19:07










  • I think that, with high probability, Sherry really means "a general nonlinear function" rather than "a unknown nonlinear function." Indeed Sherry is contrasting to the "linear function" case, for which "general nonlinear function" seems to be the most appropriate opposite case. So, the answer that was (unfortunately) deleted was likely the answer being sought by the asker.
    – Michael
    Aug 27 at 19:46













up vote
2
down vote

favorite
1









up vote
2
down vote

favorite
1






1





I know how to solve when $f(x)$ is linear, but how to solve the equation $x''=f(x)$ with $f$ a unknown nonlinear function using numerical methods?



Any references would be helpful. Thanks!



Update: Sorry that I am not clear about it, what I mean is the exact form of $f$ is unknown, but you can think it as a black box and you can get values at any points from $f$.







share|cite|improve this question














I know how to solve when $f(x)$ is linear, but how to solve the equation $x''=f(x)$ with $f$ a unknown nonlinear function using numerical methods?



Any references would be helpful. Thanks!



Update: Sorry that I am not clear about it, what I mean is the exact form of $f$ is unknown, but you can think it as a black box and you can get values at any points from $f$.









share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Aug 28 at 0:51

























asked Aug 27 at 18:15









Sherry

2,112523




2,112523







  • 1




    If $f$ is truly unknown, you're somewhat dead in the water with respect to numerical methods. You can do $(x')^2/2=int f(x),x',dt=int f(x),dx,$ for a single formal integration, but that's about as far as you can get.
    – Adrian Keister
    Aug 27 at 18:36







  • 1




    Perhaps instead of saying an "unknown" function, one may ask about a "black box" function $f$, i.e. the internal details are unknown but we can evaluate it at any point.
    – hardmath
    Aug 27 at 18:55






  • 1




    I think you need to clarify what you mean by "unknown". As written, this is like asking "How can you solve an equation when you don't know what is on the right-hand side?" The obvious answer is you can't.
    – mweiss
    Aug 27 at 19:07










  • I think that, with high probability, Sherry really means "a general nonlinear function" rather than "a unknown nonlinear function." Indeed Sherry is contrasting to the "linear function" case, for which "general nonlinear function" seems to be the most appropriate opposite case. So, the answer that was (unfortunately) deleted was likely the answer being sought by the asker.
    – Michael
    Aug 27 at 19:46













  • 1




    If $f$ is truly unknown, you're somewhat dead in the water with respect to numerical methods. You can do $(x')^2/2=int f(x),x',dt=int f(x),dx,$ for a single formal integration, but that's about as far as you can get.
    – Adrian Keister
    Aug 27 at 18:36







  • 1




    Perhaps instead of saying an "unknown" function, one may ask about a "black box" function $f$, i.e. the internal details are unknown but we can evaluate it at any point.
    – hardmath
    Aug 27 at 18:55






  • 1




    I think you need to clarify what you mean by "unknown". As written, this is like asking "How can you solve an equation when you don't know what is on the right-hand side?" The obvious answer is you can't.
    – mweiss
    Aug 27 at 19:07










  • I think that, with high probability, Sherry really means "a general nonlinear function" rather than "a unknown nonlinear function." Indeed Sherry is contrasting to the "linear function" case, for which "general nonlinear function" seems to be the most appropriate opposite case. So, the answer that was (unfortunately) deleted was likely the answer being sought by the asker.
    – Michael
    Aug 27 at 19:46








1




1




If $f$ is truly unknown, you're somewhat dead in the water with respect to numerical methods. You can do $(x')^2/2=int f(x),x',dt=int f(x),dx,$ for a single formal integration, but that's about as far as you can get.
– Adrian Keister
Aug 27 at 18:36





If $f$ is truly unknown, you're somewhat dead in the water with respect to numerical methods. You can do $(x')^2/2=int f(x),x',dt=int f(x),dx,$ for a single formal integration, but that's about as far as you can get.
– Adrian Keister
Aug 27 at 18:36





1




1




Perhaps instead of saying an "unknown" function, one may ask about a "black box" function $f$, i.e. the internal details are unknown but we can evaluate it at any point.
– hardmath
Aug 27 at 18:55




Perhaps instead of saying an "unknown" function, one may ask about a "black box" function $f$, i.e. the internal details are unknown but we can evaluate it at any point.
– hardmath
Aug 27 at 18:55




1




1




I think you need to clarify what you mean by "unknown". As written, this is like asking "How can you solve an equation when you don't know what is on the right-hand side?" The obvious answer is you can't.
– mweiss
Aug 27 at 19:07




I think you need to clarify what you mean by "unknown". As written, this is like asking "How can you solve an equation when you don't know what is on the right-hand side?" The obvious answer is you can't.
– mweiss
Aug 27 at 19:07












I think that, with high probability, Sherry really means "a general nonlinear function" rather than "a unknown nonlinear function." Indeed Sherry is contrasting to the "linear function" case, for which "general nonlinear function" seems to be the most appropriate opposite case. So, the answer that was (unfortunately) deleted was likely the answer being sought by the asker.
– Michael
Aug 27 at 19:46





I think that, with high probability, Sherry really means "a general nonlinear function" rather than "a unknown nonlinear function." Indeed Sherry is contrasting to the "linear function" case, for which "general nonlinear function" seems to be the most appropriate opposite case. So, the answer that was (unfortunately) deleted was likely the answer being sought by the asker.
– Michael
Aug 27 at 19:46











1 Answer
1






active

oldest

votes

















up vote
1
down vote













Generally you convert the second order ODE in the first order:
$$
beginpmatrix
v'\
x'
endpmatrix =
beginpmatrix
f(x)\
v
endpmatrix
$$



Here I used a notation common in mathematical physics where generally the new variable $v$ is the velocity, i.e. the first derivate.



Now you use a double step:



  • first you solve $v' = f(x)$

  • after you solve $x' = v$

Until this point there is no difference between the linear and the non linear case.



The difference is the choice of the numerical method. For the non linear case an
implicit method involve to solve non linear equation, this can be a delicate passage
where you must determine how and which solution to consider. For example think the case that come from a dynamic problem where $f$ is quadratic with the velocity and try to use the most simple implicit method as Eulero implicit.



So in general you use IMEX methods where you use an explicit discretization for the non linear terms and implicit for the linear terms. In your problem you do not know the form of $f$ and you can not split the operator, so you can use an explicit numerical scheme for the first equation and an implicit scheme for the second.
As explicit scheme you can choice, for example, a scheme as Adam-Bashord




For some equation is possible to solve it without the reduction to the first order, see Numerov's method






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%2f2896492%2fhow-to-solve-x-fx-numerically%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
    1
    down vote













    Generally you convert the second order ODE in the first order:
    $$
    beginpmatrix
    v'\
    x'
    endpmatrix =
    beginpmatrix
    f(x)\
    v
    endpmatrix
    $$



    Here I used a notation common in mathematical physics where generally the new variable $v$ is the velocity, i.e. the first derivate.



    Now you use a double step:



    • first you solve $v' = f(x)$

    • after you solve $x' = v$

    Until this point there is no difference between the linear and the non linear case.



    The difference is the choice of the numerical method. For the non linear case an
    implicit method involve to solve non linear equation, this can be a delicate passage
    where you must determine how and which solution to consider. For example think the case that come from a dynamic problem where $f$ is quadratic with the velocity and try to use the most simple implicit method as Eulero implicit.



    So in general you use IMEX methods where you use an explicit discretization for the non linear terms and implicit for the linear terms. In your problem you do not know the form of $f$ and you can not split the operator, so you can use an explicit numerical scheme for the first equation and an implicit scheme for the second.
    As explicit scheme you can choice, for example, a scheme as Adam-Bashord




    For some equation is possible to solve it without the reduction to the first order, see Numerov's method






    share|cite|improve this answer
























      up vote
      1
      down vote













      Generally you convert the second order ODE in the first order:
      $$
      beginpmatrix
      v'\
      x'
      endpmatrix =
      beginpmatrix
      f(x)\
      v
      endpmatrix
      $$



      Here I used a notation common in mathematical physics where generally the new variable $v$ is the velocity, i.e. the first derivate.



      Now you use a double step:



      • first you solve $v' = f(x)$

      • after you solve $x' = v$

      Until this point there is no difference between the linear and the non linear case.



      The difference is the choice of the numerical method. For the non linear case an
      implicit method involve to solve non linear equation, this can be a delicate passage
      where you must determine how and which solution to consider. For example think the case that come from a dynamic problem where $f$ is quadratic with the velocity and try to use the most simple implicit method as Eulero implicit.



      So in general you use IMEX methods where you use an explicit discretization for the non linear terms and implicit for the linear terms. In your problem you do not know the form of $f$ and you can not split the operator, so you can use an explicit numerical scheme for the first equation and an implicit scheme for the second.
      As explicit scheme you can choice, for example, a scheme as Adam-Bashord




      For some equation is possible to solve it without the reduction to the first order, see Numerov's method






      share|cite|improve this answer






















        up vote
        1
        down vote










        up vote
        1
        down vote









        Generally you convert the second order ODE in the first order:
        $$
        beginpmatrix
        v'\
        x'
        endpmatrix =
        beginpmatrix
        f(x)\
        v
        endpmatrix
        $$



        Here I used a notation common in mathematical physics where generally the new variable $v$ is the velocity, i.e. the first derivate.



        Now you use a double step:



        • first you solve $v' = f(x)$

        • after you solve $x' = v$

        Until this point there is no difference between the linear and the non linear case.



        The difference is the choice of the numerical method. For the non linear case an
        implicit method involve to solve non linear equation, this can be a delicate passage
        where you must determine how and which solution to consider. For example think the case that come from a dynamic problem where $f$ is quadratic with the velocity and try to use the most simple implicit method as Eulero implicit.



        So in general you use IMEX methods where you use an explicit discretization for the non linear terms and implicit for the linear terms. In your problem you do not know the form of $f$ and you can not split the operator, so you can use an explicit numerical scheme for the first equation and an implicit scheme for the second.
        As explicit scheme you can choice, for example, a scheme as Adam-Bashord




        For some equation is possible to solve it without the reduction to the first order, see Numerov's method






        share|cite|improve this answer












        Generally you convert the second order ODE in the first order:
        $$
        beginpmatrix
        v'\
        x'
        endpmatrix =
        beginpmatrix
        f(x)\
        v
        endpmatrix
        $$



        Here I used a notation common in mathematical physics where generally the new variable $v$ is the velocity, i.e. the first derivate.



        Now you use a double step:



        • first you solve $v' = f(x)$

        • after you solve $x' = v$

        Until this point there is no difference between the linear and the non linear case.



        The difference is the choice of the numerical method. For the non linear case an
        implicit method involve to solve non linear equation, this can be a delicate passage
        where you must determine how and which solution to consider. For example think the case that come from a dynamic problem where $f$ is quadratic with the velocity and try to use the most simple implicit method as Eulero implicit.



        So in general you use IMEX methods where you use an explicit discretization for the non linear terms and implicit for the linear terms. In your problem you do not know the form of $f$ and you can not split the operator, so you can use an explicit numerical scheme for the first equation and an implicit scheme for the second.
        As explicit scheme you can choice, for example, a scheme as Adam-Bashord




        For some equation is possible to solve it without the reduction to the first order, see Numerov's method







        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Aug 28 at 14:24









        Mauro Vanzetto

        36116




        36116



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2896492%2fhow-to-solve-x-fx-numerically%23new-answer', 'question_page');

            );

            Post as a guest













































































            這個網誌中的熱門文章

            How to combine Bézier curves to a surface?

            Mutual Information Always Non-negative

            Why am i infinitely getting the same tweet with the Twitter Search API?