void main() { long double FNF(long double, long double); fstream out_file; //creates variable for a file long double x1=1,h=0,x0=0,y0=0,k=0,k1=0,k2=0,k3=0,k4=0; long double x=0,y=0; //initial x y int n=0; //number of steps out_file.open("c:\\windows\\desktop\\rungekut.txt",ios::out);//opens a file for output cout <<"y= ? "; cin >> y; cout <<"\nx= ? "; cin >> x; cout <<"\nn= ? "; cin >> n; h= (x1-x)/n; //step size for(int i=1; i<=n; i++) { x0=x; y0=y; k1= FNF(x,y); //call function x= x0 + h/2; y = y0+ h*k1/2; k2= FNF(x,y); //call function y= y0 + h*k2/2; k3 = FNF(x,y); //call function x= x0+h; y= y0+ h*k3; k4= FNF(x,y); //call function k= (k1 + 2*k2 + 2*k3 + k4)/6; y = y0 + h*k; cout.precision(10); out_file.precision(10); cout << "\nx= " << x << " y= " << y << " "; //output out_file << "\nx= " << x << " y= " << y << " "; //output to a file for printing } out_file.close();//closes out put file char hold; cout <<'\n'; cin >> hold; return; }
Fonc_Num SurfIER_Fonc_Num_Not_Comp::deriv(INT k) const { ELISE_ASSERT(mFctr==SurfIER,"SurfIER_Fonc_Num_Not_Comp::deriv"); return fCEl.x.deriv(k) * FNF("DerCElXSurfIER",DerCElXSurfIER) + fCEl.y.deriv(k) * FNF("DerCElYSurfIER",DerCElYSurfIER) + fA.deriv(k) * FNF("DerASurfIER",DerASurfIER) + fB.deriv(k) * FNF("DerBSurfIER",DerBSurfIER) + fC.deriv(k) * FNF("DerCSurfIER",DerCSurfIER) + fP0.x.deriv(k) * FNF("DerP0XSurfIER",DerP0XSurfIER) + fP0.y.deriv(k) * FNF("DerP0YSurfIER",DerP0YSurfIER) + fP1.x.deriv(k) * FNF("DerP1XSurfIER",DerP1XSurfIER) + fP1.y.deriv(k) * FNF("DerP1YSurfIER",DerP1YSurfIER); }