This procedure is a program written by the third grade study of the third grade of the university. The computer is based on mathematics. It is a good understanding to help us learn.
#include #include #include #include #define M 80double f (double, double); // void run, Double 4 (Double, Double, Double, Double, Double); Void Runge4 (Double A, Double B, Double RK [], Double H, Double x []) {INT K, Max; Double K1, K2, K3, K4; Max = (INT) ((BA) ) / h); x [0] = a; for (k = 1; k <= max; k ) // Runge-kutta {x [k] = x [k-1] h; k1 = f (x [K-1], RK [K-1]); K2 = f ((x [k-1] h * 0.5), (RK [K-1] H * 0.5 * k1)); k3 = f ((x [k-1] h * 0.5), (RK [k-1] h * 0.5 * k2)); k4 = f ((x [k-1] h), (RK [k- 1] h * k3)); RK [k] = rk [k-1] h * (K1 2 * K2 2 * K3 K4) / 6;}} void main () {Double X [M ] = {0.0}, A, B, H, Y [M] = {0.0}, K [5], Y0; INT N, I, M; COUT << "Input Y (0):"; CIN >> y [0]; cout << "input h:"; cin >> h; cout << "input A:"; cin >> a; cout << "input B:"; cin >> b; x [0 ] = a; n = (int); Runge4 (A, A 3 * H, Y, H, X); for (i = 0; i <4; i ) {k [i ] = f (x [i], y [i]);} for (i = 3; i 0; m - k [m-1] = k [m]; k [3] = f (x [i 1], y [i 1]);} cout << "Run results Yes : "<< Endl; for (i = 0; i <= n; i ) {printf (" x [% d] =% 0.3LF / t ", I, x [i]); printf (" y [% D]% 0.8LF / N ", I, Y [I]);}}} Double F (Double X, Double Y) {Return (1-Y);} /