I'm trying to solve the following problem using RK4:
$$y'=y^{\frac{1}{3}}, \quad y(0)=0, \quad t\in[0,6].$$
The exact solution is $y(t)=\sqrt{\left( \frac{2t}{3} \right)^{3}}$. I wrote the following code:
int main(){
double a = 0;
double b = 6;
double t_0 = 0;
double y_0 = 0;
int n = 10000;
double h = (b-a)/n;
double t[n+1];
double y_RK[n+1];
t[0]=t_0;
y_RK[0]=y_0;
double k1,k2,k3,k4;
for(int i=0; i<n; ++i){
k1 = f(t[i],y_RK[i]);
k2 = f(t[i] + h/2, y_RK[i] + (h/2)*k1);
k3 = f(t[i] + h/2, y_RK[i] + (h/2)*k2);
k4 = f(t[i] + h,y_RK[i]+h*k3);
t[i+1]=t[i]+h;
y_RK[i+1] = y_RK[i] + (h/6)*(k1 + 2*(k2+k3) + k4);
}
}
However, the result I'm getting is this: 
Why isn't it working? Sorry for remaking the question, I realised I was doing it wrong previously, but now I rewrote the code and it still doesn't converge. I'm not sure if this exercise is meant to illustrate that RK4 doesn't always work (the question says "investigate"), or if I'm making a mistake?