%
% 	Runge Kutta method.
%
% 	Arguments:
% 		A (matrix)   Butcher tableau matrix.
% 		b (vector)   Butcher tableau b.
% 		c (vector)   Butcher tableau c.
% 		t (scalar)   Current time.
% 		y (vector)   Current value.
% 		h (scalar)   Step length.
% 		f (function) Right-hand side of ODE.
%
% 	Returns:
% 		y     (vector)   Next value.
%
function y = rk(A, b, c, t, y, h, f)
	k = [f(t,y)];
	for s = 1:size(A, 1)
		ts = t + c(s);
		ys = y + h*k*A(s,1:(s-1))';
		ks = f(ts, ys);
		k = [k, ks];
	end

	y = y + h*k*b';
end