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.