Mathc initiation/c33cb

Un livre de Wikilivres.


Sommaire


Installer et compiler ces fichiers dans votre répertoire de travail.


c00b.c
/* --------------------------------- */
/* save as c00b.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fb.h"
/* --------------------------------- */
int main(void)
{
double nx =  2*150, ny = 2*150,  
       M = 0;

 clrscrn();
 
 printf(" f  : (x,y)-> %s  \n\n",  feq);
 
 printf(" by :   (x)-> %s    \n", byeq); 
 printf(" ay :   (x)-> %s  \n\n", ayeq);
 
 printf(" bx :         %s    \n", bxeq);
 printf(" ax :         %s\n\n\n", axeq);

 M = trapezoid_dydx(f, ay,by,ny, ax,bx,nx);

 printf(" With the trapezoidal's rule.\n\n");
 printf("    (%.3f  (%s\n",      bx,byeq);
 printf(" int(    int(       %s  dy dx = %.6f\n", feq, M);
 printf("    (%.3f  (%s\n\n\n",  ax,ayeq);

 stop();

 return 0;
}
/* --------------------------------- */
/* --------------------------------- */
  Même résultat que la version avec l'algorithme de Simpson à quelques décimales près.

Exemple de sortie écran :

 f  : (x,y)-> 1  

 by :   (x)-> 8-(x**2/2)    
 ay :   (x)-> 2-(x/2)  

 bx :         +4    
 ax :         -3


 With the trapezoidal's rule.

    (4.000  (8-(x**2/2)
 int(    int(       1  dy dx = 28.583016
    (-3.000  (2-(x/2)


 Press return to continue.