Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
dv=vector(1,nvar); for (i=1;i | 714 Chapter 16. Integration of Ordinary Differential Equations dv vector 1 nvar for i 1 i nvar i Load starting values. v i vstart i y i 1 v i xx 1 x1 x x1 h x2-x1 nstep for k 1 k nstep k Take nstep steps. derivs x v dv rk4 v dv nvar x h vout derivs if float x h x nrerror Step size too small in routine rkdumb x h xx k 1 x Store intermediate steps. for i 1 i nvar i v i vout i y i k 1 v i free_vector dv 1 nvar free_vector vout 1 nvar free_vector v 1 nvar CITED REFERENCES AND FURTHER READING Abramowitz M. and Stegun I.A. 1964 Handbook of Mathematical Functions Applied Mathematics Series Volume 55 Washington National Bureau of Standards reprinted 1968 by Dover Publications New York 25.5. 1 Gear C.W. 1971 Numerical Initial Value Problems in Ordinary Differential Equations Englewood Cliffs NJ Prentice-Hall Chapter 2. 2 Shampine L.F. and Watts H.A. 1977 in Mathematical Software III J.R. Rice ed. New York Academic Press pp. 257-275 1979 Applied Mathematics and Computation vol. 5 pp. 93-121. 3 Rice J.R. 1983 Numerical Methods Software andAnalysis New York McGraw-Hill 9.2. 16.2Adaptive Stepsize Control forRunge-Kutta A good ODE integrator should exert some adaptive control over its own progress making frequent changes in its stepsize. Usually the purpose of this adaptive stepsize control is to achieve some predetermined accuracy in the solution with minimum computational effort. Many small steps should tiptoe through treacherous terrain while a few great strides should speed through smooth uninteresting countryside. The resulting gains in efficiency are not mere tens of percents or factors of two they can sometimes be factors of ten a hundred or more. Sometimes accuracy may be demanded not directly in the solution itself but in some related conserved quantity that can be monitored. Implementation of adaptive stepsize control requires that the stepping algorithm signal information about its performance most important an estimate of its truncation error. In this section we will