# Second order non-linear difference equation solver.

Is there an algorithm which I can use to find an approximate solution of the following second-order difference equation in order to run simulations of the solution :

$$\nu(1 - \beta) f(u_{n+1})-g(u_{n+1}-u_{n}) + \beta g (u_{n+2} - u_{n+1}) = 0$$

with $$\nu > 0$$ and $$0 < \beta < 1$$ and $$u_0 = 0$$ and $$u_N = C > 0$$ and $$N \in \mathbb{N}^{*}$$ and $$f$$ and $$g$$ two real, positive and increasing functions.

Thank you.

Rewrite as $$u_n = u_{n+1} - g^{-1}\bigl[(1-\beta)\nu f(u_{n+1})+\beta g(u_{n+2}-u_{n+1})\bigr].$$
If you fix $$u_N=C$$ (as given in the problem) and also $$u_{N-1}$$, then you can use the previous recurrence formula to solve backward for $$x_{N-2},x_{N-3},\dots,x_1,x_0$$. Then the problem becomes to find an appropriate value for $$x_{N-1}$$ so that you end up with $$x_0=0$$.
This is what is called shooting method for the boundary value problem $$x_0=0$$, $$x_N=C$$.
In precise terms, through the above backward solution, you get a map $$\phi:\mathbb R\to\mathbb R$$ which gives you $$x_0=\phi(x_{N-1})$$. Your goal is now to solve $$\phi(x)=0$$. This can be done in several ways, noting in particular that if $$f,g,g^{-1}$$ are differentiable, then $$\phi$$ is also differentiable, so you may be able to use Newton's method, beside the bisection method.
• @AlexC75 Of course the feasibility of this approach depends on how good the functions $f$ and $g$ are. I'm glad it works fine for you. – Federico Dec 13 '18 at 17:48