C code using Runge-Kutta 4th order method

Problem: Here we have to find y(0,2) and y(0,4), Given dy/dx=1+y^2 where y=0 when x=0

Algorithm:

Step 1: input x0,y0,h,last point n

Step 2:m1=f(xi,yi)

Step 3:m2=f(xi+h/2,yi+m1h/2)

Step 4:m3=f(xi+h/2,yi+m2h/2)

Step 5:m4=f(xi+h,yi+m3h)

Step 6:yi+1=yi+(m1+2m2+2m3+m4/6)h

Step 5:Display output

Code:

 Output:

runge kutta