/******************************************************* * This program calculates the discreet primitive P(x) * * of a user defined real function F(x) in n points by * * using a classical Runge-Kutta method of order 4 * * (version with graphic display of primitive P(x)). * * ---------------------------------------------------- * * SAMPLE RUN: * * (Calculate 20 points of the primitive of F(x)=x * * from x=-5 to x=5 with a finesse of 2. the value of * * the primitive at x=-5 will be given as 25/2). * * * * Value of x begin: -5 * * Value of x end : 5 * * Value of primitive in x begin: 12.5 * * Number of points to calculate: 50 * * Number of intermediate points: 2 * * * * (Exact values are yi = xi*xi/2). * * * * A graph of the primitive P(x) is displayed. * * * * C++ version in API style by J-P Moreau, Paris. * * (www.jpmoreau.fr) * ******************************************************** Used files: gprimitiv.mak, basis.h (optionnal), graph2d.cpp, graph2d.h, ------------------------------------------------------*/ #include #include #include // SQRT, REAL etc. #include HDC hdc; RECT rect; HPEN hpen, hpenOld; //Functions used here of graph2D.cpp void CourbeXY(int,int,float *,REAL,REAL); void Legendes (int,char *,char *,char *,int,int,char *,int,int,char *); //Function of fourier.cpp void AnalyticFourierHn(REAL,REAL,int,REAL *,REAL *); //"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; REAL dx,dy; if (ix2