# Implementing Adams-Bashforth of order 2 (AB2) algoirthm

Assuming we are given the initial condition for an ODE such that:

$$\begin{cases} x' = f(x,t) \\ x(t_0) = x_0 \end{cases}$$

We are going to solve it numerically using AB2.

We know that the first iteration of AB2 produces $x_{2}$ using $x_{1}$ and $x_0$.

So it need two nodes to start. but we have only one node given in initial condition. I never paid attention to this until I myself wanted to code the AB2 algorithm.

What should I do to find $x_{1}$?

Another option is to compute a backward step; As you know the derivative at any point, you could evaluate it at $x_0$ to approximate the value of $x$ at the previous time, using backward difference approximation of derivative: $$\frac{x_0 - x_{-1}}{h} = x'(t_0, x_0) \rightarrow x_{-1} = x_0 - h \ x'(t_0, x_0)$$
where $h$ is the time step.
Ok I think I found the answer by myself. In situations like this we can use another method that only need one node, to approximate the second node $x_1$.
So one should take the initial condition $x_0$ and then use a numerical method (for example forward Euler) to approximate the next node $x_1$ then uses these two nodes to boot up the AB2 iterations.