是用c++编写的算法,简洁明了。 #include #include double function(double x,double y) { return y-2*x/y; } /*n表示几等分,n+1表示他输出的个数*/ int RungeKutta(double y0,double a,double b,int n,double *x,double *y) { double h=(b-a)/n,k1,k2,k3,k4; int i; x[0]=a; y[0]=y0; for(i=0;i