procedure rungekutta(X0,Y0,H,M,N,Q,TETA,A,X,V,F); value X0,H,M,N; real X0,H; integer M,N,Q; array Y0,TETA,A,X,V; procedure F; procedure integro 1(X0,Y0,H,M,N,X,V); value X0,H,M,N; real X0,H; integer M,N; array Y0,X,V;
Integrates the first order system y = f(x,y) from x = X0 to x = X0 + M × H where y and f are N-vectors. The method used is 4th-order Runge-Kutta. Values of x are stored in X[0:M] and the value of y at x = X0 + k × H is stored in the kth column of V[1:N,0:M]. rungekutta is called internally by integro 1, so that the only input parameters required are F,X0,Y0,H,M,N. Only integro 1 is called by the user. (The parameters Q,TETA, and A are set in integro 1).
Difficulties may arise if transient solutions are present since these will not be computed accurately unless H is very small. For example, the solution of y' = -λy (λ > 0) is not computed accurately if λH > 2.8.
The procedure F is defined as:-
procedure F(X,Y,G,N); real X; integer N; array Y,G;
The procedure must define G[i] equal to fi(X,Y[1], ... , Y[N]);
procedure rungekutta(X0,Y0,YP0,H,M,N,Q,TETA,A,B,X,V,VP,F); value X0,H,M,N; real X0,H; integer M,N,Q; array Y0,YP0,TETA,A,B,X,V,VP; procedure F; procedure integro 2(X0,Y0,YP0,H,M,N,X,V,VP); value X0,H,M,N; real X0,H; integer M,N; array Y0,YP0,X,V,VP;
Integrates the 2nd order system y" = f(x,y,y'), where y, f are N-vectors, from x = X0 to x = X0 + M × H by a 4th order Runge-Kutta method. The initial conditions y(X0) and y'(X0) are stored in Y0,YP0[1:N] and the solution y,y' at x = X0 + k × H = X[k] is stored in the kth columns of V,VP[1:N,0:M]. Only integro 2 is called and the input parameters required are F,X0,Y0,YP0,H,M,N.
Tne procedure F is defined as:-
procedure F(X,Y,YP,G,N); real X; integer N; array Y,YP,G;
The procedure calculates G[i] = fi(X,Y[1], ... Y[N],YP[1], ... YP[N])
procedure rungekutta(X0,Y0,YP0,H,M,N,Q,TETA,A,B,X,V,VP,F); value X0,H,M,N; real X0,H; integer M,N,Q; array Y0,YP0,TETA,A,B,X,V,VP; procedure F; procedure integrobis(X0,Y0,YP0,H,M,N,X,V,VP); value X0,H,M,N; real X0,H; integer M,N; array Y0,YP0,X,V,VP;
Integrates the special 2nd order system y" = f(x,y) (y, f are N-vectors) from x = X0 to x = X0 + M × H by a 4th order Runge-Kutta method. The significance of the parameters is the same as above i.e. initial values in Y0,YP0[1:N] and solution as columns of V,VP[1:N,0:M] Only integrobis is called by the user and input parameters required are F,X0,Y0,YP0,H,M,N. The definitLon of F is the same as in ICT76.