ODE with Euler Method












0












$begingroup$


I have to solve the following ODE: $y'(t)=y(t)+t$, $y(0)=0$
with Eulers Method in two steps, where $h=0.1$. I tried the following:
$y'(0)=y(0)+0=0$ and then I get $y(0.1)=y(0)+h*y'(0)=0$ but then everything will be 0. I do not get how to solve this.










share|cite|improve this question









$endgroup$












  • $begingroup$
    $y=0$ is the solution for initial condition $y(0)=0$. Choose a more interesting initial condition e.g. $y(0)=1$ and try again.
    $endgroup$
    – xidgel
    Jan 23 at 18:56










  • $begingroup$
    @xidgel : No, there is a non-zero forcing term, the general solution is $y(t)=ce^t-1-t$ and $c=1$ for $y(0)=0$.
    $endgroup$
    – LutzL
    Jan 23 at 19:14










  • $begingroup$
    @LutzL Thanks for catching that.
    $endgroup$
    – xidgel
    Jan 23 at 19:16
















0












$begingroup$


I have to solve the following ODE: $y'(t)=y(t)+t$, $y(0)=0$
with Eulers Method in two steps, where $h=0.1$. I tried the following:
$y'(0)=y(0)+0=0$ and then I get $y(0.1)=y(0)+h*y'(0)=0$ but then everything will be 0. I do not get how to solve this.










share|cite|improve this question









$endgroup$












  • $begingroup$
    $y=0$ is the solution for initial condition $y(0)=0$. Choose a more interesting initial condition e.g. $y(0)=1$ and try again.
    $endgroup$
    – xidgel
    Jan 23 at 18:56










  • $begingroup$
    @xidgel : No, there is a non-zero forcing term, the general solution is $y(t)=ce^t-1-t$ and $c=1$ for $y(0)=0$.
    $endgroup$
    – LutzL
    Jan 23 at 19:14










  • $begingroup$
    @LutzL Thanks for catching that.
    $endgroup$
    – xidgel
    Jan 23 at 19:16














0












0








0





$begingroup$


I have to solve the following ODE: $y'(t)=y(t)+t$, $y(0)=0$
with Eulers Method in two steps, where $h=0.1$. I tried the following:
$y'(0)=y(0)+0=0$ and then I get $y(0.1)=y(0)+h*y'(0)=0$ but then everything will be 0. I do not get how to solve this.










share|cite|improve this question









$endgroup$




I have to solve the following ODE: $y'(t)=y(t)+t$, $y(0)=0$
with Eulers Method in two steps, where $h=0.1$. I tried the following:
$y'(0)=y(0)+0=0$ and then I get $y(0.1)=y(0)+h*y'(0)=0$ but then everything will be 0. I do not get how to solve this.







ordinary-differential-equations eulers-method






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Jan 23 at 18:12









Natalie_94Natalie_94

316




316












  • $begingroup$
    $y=0$ is the solution for initial condition $y(0)=0$. Choose a more interesting initial condition e.g. $y(0)=1$ and try again.
    $endgroup$
    – xidgel
    Jan 23 at 18:56










  • $begingroup$
    @xidgel : No, there is a non-zero forcing term, the general solution is $y(t)=ce^t-1-t$ and $c=1$ for $y(0)=0$.
    $endgroup$
    – LutzL
    Jan 23 at 19:14










  • $begingroup$
    @LutzL Thanks for catching that.
    $endgroup$
    – xidgel
    Jan 23 at 19:16


















  • $begingroup$
    $y=0$ is the solution for initial condition $y(0)=0$. Choose a more interesting initial condition e.g. $y(0)=1$ and try again.
    $endgroup$
    – xidgel
    Jan 23 at 18:56










  • $begingroup$
    @xidgel : No, there is a non-zero forcing term, the general solution is $y(t)=ce^t-1-t$ and $c=1$ for $y(0)=0$.
    $endgroup$
    – LutzL
    Jan 23 at 19:14










  • $begingroup$
    @LutzL Thanks for catching that.
    $endgroup$
    – xidgel
    Jan 23 at 19:16
















$begingroup$
$y=0$ is the solution for initial condition $y(0)=0$. Choose a more interesting initial condition e.g. $y(0)=1$ and try again.
$endgroup$
– xidgel
Jan 23 at 18:56




$begingroup$
$y=0$ is the solution for initial condition $y(0)=0$. Choose a more interesting initial condition e.g. $y(0)=1$ and try again.
$endgroup$
– xidgel
Jan 23 at 18:56












$begingroup$
@xidgel : No, there is a non-zero forcing term, the general solution is $y(t)=ce^t-1-t$ and $c=1$ for $y(0)=0$.
$endgroup$
– LutzL
Jan 23 at 19:14




$begingroup$
@xidgel : No, there is a non-zero forcing term, the general solution is $y(t)=ce^t-1-t$ and $c=1$ for $y(0)=0$.
$endgroup$
– LutzL
Jan 23 at 19:14












$begingroup$
@LutzL Thanks for catching that.
$endgroup$
– xidgel
Jan 23 at 19:16




$begingroup$
@LutzL Thanks for catching that.
$endgroup$
– xidgel
Jan 23 at 19:16










1 Answer
1






active

oldest

votes


















0












$begingroup$

In the next step you get $f(0.1, 0)=0.1$ so that you get a non-zero value for the approximation at $0.2$.





The leading error coefficient in $y_k=y(t_k)+c(t_k)h+O(h^2)$ is a solution of $$c'(t)=f_y(t,y)c-frac12y''=c-frac12e^t, \~~text{ so that }~~
(e^{-t}c)'=-frac12implies c(t)=-frac12te^t
$$



Plotting the actual error coefficient $frac{y_k-y(t_k)}h$ against this first term curve for several values of $h$ gives the image



enter image description here



So that indeed the Euler points are below the exact solution, for large $h$ this can be a large error, and for $h=0.1$ the error is as large as the value of the solution.






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%2f3084850%2fode-with-euler-method%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$

    In the next step you get $f(0.1, 0)=0.1$ so that you get a non-zero value for the approximation at $0.2$.





    The leading error coefficient in $y_k=y(t_k)+c(t_k)h+O(h^2)$ is a solution of $$c'(t)=f_y(t,y)c-frac12y''=c-frac12e^t, \~~text{ so that }~~
    (e^{-t}c)'=-frac12implies c(t)=-frac12te^t
    $$



    Plotting the actual error coefficient $frac{y_k-y(t_k)}h$ against this first term curve for several values of $h$ gives the image



    enter image description here



    So that indeed the Euler points are below the exact solution, for large $h$ this can be a large error, and for $h=0.1$ the error is as large as the value of the solution.






    share|cite|improve this answer











    $endgroup$


















      0












      $begingroup$

      In the next step you get $f(0.1, 0)=0.1$ so that you get a non-zero value for the approximation at $0.2$.





      The leading error coefficient in $y_k=y(t_k)+c(t_k)h+O(h^2)$ is a solution of $$c'(t)=f_y(t,y)c-frac12y''=c-frac12e^t, \~~text{ so that }~~
      (e^{-t}c)'=-frac12implies c(t)=-frac12te^t
      $$



      Plotting the actual error coefficient $frac{y_k-y(t_k)}h$ against this first term curve for several values of $h$ gives the image



      enter image description here



      So that indeed the Euler points are below the exact solution, for large $h$ this can be a large error, and for $h=0.1$ the error is as large as the value of the solution.






      share|cite|improve this answer











      $endgroup$
















        0












        0








        0





        $begingroup$

        In the next step you get $f(0.1, 0)=0.1$ so that you get a non-zero value for the approximation at $0.2$.





        The leading error coefficient in $y_k=y(t_k)+c(t_k)h+O(h^2)$ is a solution of $$c'(t)=f_y(t,y)c-frac12y''=c-frac12e^t, \~~text{ so that }~~
        (e^{-t}c)'=-frac12implies c(t)=-frac12te^t
        $$



        Plotting the actual error coefficient $frac{y_k-y(t_k)}h$ against this first term curve for several values of $h$ gives the image



        enter image description here



        So that indeed the Euler points are below the exact solution, for large $h$ this can be a large error, and for $h=0.1$ the error is as large as the value of the solution.






        share|cite|improve this answer











        $endgroup$



        In the next step you get $f(0.1, 0)=0.1$ so that you get a non-zero value for the approximation at $0.2$.





        The leading error coefficient in $y_k=y(t_k)+c(t_k)h+O(h^2)$ is a solution of $$c'(t)=f_y(t,y)c-frac12y''=c-frac12e^t, \~~text{ so that }~~
        (e^{-t}c)'=-frac12implies c(t)=-frac12te^t
        $$



        Plotting the actual error coefficient $frac{y_k-y(t_k)}h$ against this first term curve for several values of $h$ gives the image



        enter image description here



        So that indeed the Euler points are below the exact solution, for large $h$ this can be a large error, and for $h=0.1$ the error is as large as the value of the solution.







        share|cite|improve this answer














        share|cite|improve this answer



        share|cite|improve this answer








        edited Jan 29 at 18:01

























        answered Jan 23 at 19:15









        LutzLLutzL

        59.6k42057




        59.6k42057






























            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%2f3084850%2fode-with-euler-method%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

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            Npm cannot find a required file even through it is in the searched directory