Results 1 to 3 of 3
Like Tree1Thanks
  • 1 Post By HallsofIvy

Thread: Numerical methods: Midpoint rule for integration

  1. #1
    Newbie
    Joined
    Jan 2019
    From
    Quebec
    Posts
    2

    Numerical methods: Midpoint rule for integration

    Hi. I want to solve an ode using some numerical integration methods. I have an equation of the form $\displaystyle y'(t)=f(t,y(t))$.

    Let's say my equation is: $\displaystyle y'(t)=\mu y(t)+g(t)$, with $\displaystyle \mu$ a constant, and g an arbitrary function.

    If I use Euler method, I have that $\displaystyle y_{n+1}=y_n+hf(t_n,y_n)$.

    So I would have: $\displaystyle y_{n+1}=y_n+h[\mu y_n+g_n]$

    Now, if I want to use the midpoint rule, I would have:

    $\displaystyle y_{n+1}=y_n+hf(t_n+\frac{h}{2},y_n+\frac{h}{2}f(t_ n,y_n))$.

    The problem I have is with how to intepret the term $\displaystyle f(t_n+\frac{h}{2},y_n+\frac{h}{2}f(t_n,y_n))$, for my example, what would it explicitly be? Would be it ok to take:

    $\displaystyle f(t_n+\frac{h}{2},y_n+\frac{h}{2}f(t_n,y_n))=\mu y_n+\mu\frac{h}{2}[\mu y_n +q_n]+q(t_n+\frac{h}{2})$?

    Thanks.
    Last edited by JhonD; Jan 2nd 2019 at 01:03 PM.
    Follow Math Help Forum on Facebook and Google+

  2. #2
    MHF Contributor

    Joined
    Apr 2005
    Posts
    20,078
    Thanks
    3211

    Re: Numerical methods: Midpoint rule for integration

    You seem to have switched from "g" to "q".
    Thanks from JhonD
    Follow Math Help Forum on Facebook and Google+

  3. #3
    Newbie
    Joined
    Jan 2019
    From
    Quebec
    Posts
    2

    Re: Numerical methods: Midpoint rule for integration

    Yes, you are right, it should read $\displaystyle f(t_n+\frac{h}{2},y_n+\frac{h}{2}f(t_n,y_n))=\mu y_n+\mu\frac{h}{2}[\mu y_n +g_n]+g(t_n+\frac{h}{2})$

    That would be ok?

    Great, just made a numerical testing and seems to work! thanks.
    Last edited by JhonD; Jan 3rd 2019 at 06:10 AM.
    Follow Math Help Forum on Facebook and Google+

Similar Math Help Forum Discussions

  1. Taylor Series Expansion and Midpoint Rule (Numerical Analysis)
    Posted in the Advanced Math Topics Forum
    Replies: 1
    Last Post: Nov 5th 2014, 05:10 PM
  2. Numerical Analysis Midpoint Rule Help
    Posted in the Advanced Math Topics Forum
    Replies: 2
    Last Post: May 6th 2010, 12:46 AM
  3. Integration: Numerical Methods
    Posted in the Calculus Forum
    Replies: 1
    Last Post: Feb 1st 2009, 10:51 AM
  4. Midpoint rule integration
    Posted in the Calculus Forum
    Replies: 3
    Last Post: Jan 22nd 2009, 05:25 PM
  5. Replies: 2
    Last Post: Mar 9th 2008, 01:09 PM

/mathhelpforum @mathhelpforum