# convert a ordinary differential equation to a recurrence relation

How can I create a differnce equation from a differential equation? The step size h is not given and should stay a variable. For example $y' = y^2 + x^2$ with the known value $y(1) = 2$

-
Depends. What numerical method are you using? Euler? Heun? Runge-Kutta? –  Guess who it is. Feb 8 '12 at 13:25
If you are thinking "relatively" small $h$ and looking for approximate solutions, then write $y'(x) \approx \frac{y(x+h)-y(x)}h$. So $y(x+h) \approx y(x) + hx^2 + hy(x)^2$ –  Thomas Andrews Feb 8 '12 at 13:41
We are using the Euler method. –  Julian Feb 8 '12 at 13:56

Here's a method.

$$y'(1) = 4 + 1^2$$

$$y'(1) = 5$$

$$y'' = 2 y y' + 2x$$

$$y''(1) = 2 ·2· 5 + 2 = 22$$

$$y''' = 2y'^2+2y y''+2$$

$$y'''(1) = 2 ·25 +2 ·2 ·22 +2 = 130$$

$$y^{(IV)} = 4y' y''+2y y'' + 2y y'''$$

$$y^{(IV)}(1) = 1828$$

You can go on like this. With those values we have a short Taylor Polynomial for y:

$$2 + 5(x-1) + 11(x-1)^2 + \frac{65}{3}(x-1)^3+ \frac{457}{3} (x-1)^4$$

-
More generally, there exists a recursively definable sequence of polynomials $p_n(x,y)$ in two variables such that $y^{(n)} = p_n(x,y)$. Then $y(x+h) - y(x) = \sum_{n>0} h^n p_n(x,y)$ for small enough $h$. –  Thomas Andrews Feb 8 '12 at 14:41
Specifically, $p_0(x,y)=y$, and $p_{n+1}(x,y) = D_xp_n(x,y) + D_yp_n(x,y)(x^2+y^2)$. Oh, and I forgot a factor of $n!$ in my sum in the previous. –  Thomas Andrews Feb 8 '12 at 14:47