#forward euler method

16 messages · Page 1 of 1 (latest)

idle hollow
#

bit confuse about the working of it

merry tokenBOT
dusky drift
#

So we're solving $\dot{x} = f(t, x)$ numerically

fair carbonBOT
#

spindle

dusky drift
#

The idea is that we use Taylor series

#

$x(t) = x(t_0) + \dot{x}(t_0)(t - t_0) + O((t - t_0)^2)$

fair carbonBOT
#

spindle

dusky drift
#

But we know from the equation that $\dot{x}(t_0) = f(t_0,x(t_0))$, so we can plug that into our equation

fair carbonBOT
#

spindle

dusky drift
#

That's it

#

If you want to obtain terms of higher order, then just differentiate the ODE:
$$\ddot{x} = f_t(t,x) + f_x(t,x)\dot{x} = f_t(t,x) + f_x(t,x)f(t,x)$$

fair carbonBOT
#

spindle

dusky drift
#

So now you can rewrite $x(t)$ as
$$x(t_0) + \dot{x}(t_0)(t-t_0) + \frac{1}{2}\ddot{x}(t_0)(t-t_0)^2 + O((t - t_0)^3)$$

fair carbonBOT
#

spindle

dusky drift
#

And then plug in $\dot{x}(t_0)$, $\ddot{x}(t_0)$ using the equations