Function approximation in numerical integration

57 Views Asked by At

I would like to know how are the functions approximated near an undefined integral, even thought, it is a regular singularity since it is defined in the IVP. The example reads as follows, I have the following second order equation:

$$y'' + \frac{1}{x}*y' +x = 0, \quad\quad y(0)=1,y'(0)=0$$

The system of first order equations reads as:

$$y_1' = y_2\\ y_2' = -\frac{1}{x}\cdot y_2 - x$$

With $y_1(0)=1$ and $y_2(0)=0$ and I want to integrate it by Runge-Kutta.

The solution is:

$$y = 1 - \frac{x^3}{9}$$

The problem is not the method but the regular singularity at x=0. By now, I've been able to avoid this point because I now that y2(0)=0 which multiplies $\frac{1}{x}$ in the second function and I can define this second function as:

x!=0: $y_2' = -\frac{1}{x}\cdot y_2 - x$

else: $y_2' = 0$

But the first steps give the biggest error. I want to integrate with the lowest error possible at the beginning, how can I approximate the function in the first few steps?