function retval = RK6(f,x,N)
#====================================================	
    # Roots of nonlinear system of equations continuation-Homotophy RK6
    # 6.th order Runge-Kutta 
    # yi+1 = yi + (1/6)*( k1 + 2k2 +2k3+k4)h
    # k1=f(xi,yi)
    # k2=f(xi+0.5h,yi+0.5k1h)
    # k3=f(xi+0.5h,yi+0.5k2h)
    # k4=f(xi+h,yi +k3h)
    #===================================================
    #x vector of independent variables
    #y vector of dependent variables
    #dy derivative vector of dependent variables
    nmax=400;
    tolerance=1.0e-20;
    n=length(x);
    h=1.0/N;
    b=(-h*f(x))';
    for i=1:N
        x1=x;
        A=dfi(f,x1);
        xx=A\b;
        k1=xx';
        x1=x+0.5*k1;       
        A=dfi(f,x1);
        xx=A\b;
        k2=xx';
        x1=x+0.5*k2;
        A=dfi(f,x1);
        xx=A\b;
        k3=xx';
        x1=x+k3;
        A=dfi(f,x1);
        xx=A\b;
        k4=xx';
        for j=1:n
            x(j)=x(j)+1.0/6.0*(k1(j)+2.0*k2(j)+2.0*k3(j)+k4(j));
        end
    end
    retval=x;
endfunction
