rungekutta
Solution of (non-stiff) ordinary differential equations.
(t,y)=rungekutta(func, t0, y0, h, nsteps)
(y)=rungekutta(func, t0, y0, h, nsteps, tol, hmin,hmax)
Inputs
func The function of the form (dybydt)=func(t, y) , that returns the derivative of the desired function.
t0 The initial time.
y0 Initial condition.
nsteps The number of steps.
tol The desired accuracy.
hmin Minimum step size.
hmax Maximum step size.
Outputs
t The vector of time instances at which the solution was found.
y The solution. Each row of y is the solution at the time instance in the corresponding row of t .


Example
>>class Lorenz
>    // A class that can be used to solve the Lorenz equations by calling 
>    // the function rungekutta
>	var sigma, beta, rho
>	function Lorenz(sigma, beta, rho)
>		this.sigma=sigma;
>		this.beta=beta;
>		this.rho=rho;
>	end
>    // This function overrides the functioncall method 
>    // so that the objects of this class can be used functions. 
>	function (dy)=()(x,y)
>		dy[1,1]=sigma*(y[2]-y[1]);
>		dy[2,1]=(rho-y[3])*y[1]-y[2];
>		dy[3,1]=-beta*y[3]+y[2]*y[1];
>	end
>end
>>f=new Lorenz(10,8/3,28);
>>y0=rand(3,1);
>>(t,y)=rungekutta(f,0,y0,1/100,5000,1.e-3);
>>plot(y[:,1],y[:,2],y[:,1],y[:,3])
>>ylabel('y[2], y[3]')
>>xlabel('y[1]')
>>title({'Rungekutta Test',"Solution of Lorenz Equations"})