ODE Approximation

Euler Forward Method

Euler's forward method is

fn=yn+1−ynΔtf_n = \frac{y_{n+1} - y_n}{\Delta t}

With a forward approximation, we want to look ahead the next value with the current value known. So rearrange the equation to isolate the current values on the right

yn+1=yn+fnΔty_{n+1} = y_n + f_n \Delta t

yny_n is known and Δt\Delta t is chosen by us. What is fnf_n? It's the function that we want to approximate.

dydt=f(tn,yn)\frac{dy}{dt} = f(t_n, y_n)

Since we know yny_n (it's the current value) and tnt_n ( the current time is the number of steps nn times the step size Δt\Delta t ), simply feed them to our ODE to find the fnf_n required.

Here's an example with dydt=2y\frac{dy}{dt} = 2y

yn+1=yn+2ynΔtyn+1=yn(1+2Δt)y_{n+1} = y_n + 2 y_n \Delta t \\ y_{n+1} = y_n ( 1 + 2 \Delta t )

Now the next value is always computable given the current value and a step size. However, what we had was always acceptable as a template for writing some code.

This is not good code, however, as the error from the true value is unacceptable and the runtime is inefficient. But Euler's method will get you thinking about approximation functions, and for that, it's useful to know.

See a longer write up herearrow-up-right

Last updated