/******************************************************************* * Differential equations of order 1 with 1 variable * * by Runge-Kutta method of order 4 * * * * C++ version with graphic result by J-P Moreau * * (use with teqdif1a.mak and graph2d.cpp) * * (www.jpmoreau.fr) * * ---------------------------------------------------------------- * * Reference: "Analyse en Turbo Pascal versions 5.5 et 6.0 By Marc * * DUCAMP et Alain REVERCHON - Eyrolles, Paris 1991" * * [BIBLI 03]. * * ---------------------------------------------------------------- * * SAMPLE DATA: * * * * Example: integrate y'=4x*(y+sqrt(y))/1+x^2 from x=0 to x=1 * * * * DIFFERENTIAL EQUATION WITH 1 VARIABLE OF ORDER 1 * * of type y" = f(x,y) * * * * begin value x : 0 * * end value x : 1 * * y value at x0 : 1 * * number of points: 11 * * finesse : 10 * * * * X Y * * ------------------------- * * 0.000000 1.000000 * * 0.100000 1.040400 * * 0.200000 1.166400 * * 0.300000 1.392400 * * 0.400000 1.742400 * * 0.500000 2.250000 * * 0.600000 2.958400 * * 0.700000 3.920400 * * 0.800000 5.198400 * * 0.900000 6.864400 * * 1.000000 9.000000 * * * *******************************************************************/ #include #include #include #include HDC hdc; RECT rect; HPEN hpen, hpenOld; //Functions used here of Graph2D.cpp void CourbeXY (int,int,float *,double,double); void Legendes (int,char *,char *,char *,int,int,char *,int,int,char *); //"home made" graphic commands for hdc environment used by above functions void DrawPixel(int ix,int iy) { //sorry, no other available command found Rectangle(hdc,rect.left+ix,rect.top+iy, rect.left+ix+2,rect.top+iy+1); } void Swap(int *i1,int *i2) { int it; it=*i1; *i1=*i2; *i2=it; } void DrawLine(int ix1,int iy1,int ix2,int iy2) { int i,il,ix,iy; double dx,dy; if (ix2