Mathc initiation/c33ca

Un livre de Wikilivres.


Sommaire


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


c00a.c
/* --------------------------------- */
/* save as c00a.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fa.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)-> x**2+y**2+1  

 by :   (x)-> 2-2*x    
 ay :   (x)-> 0  

 bx :         1    
 ax :         0


 With the trapezoidal's rule.

    (1.000  (2-2*x
 int(    int(       x**2+y**2+1  dy dx = 1.833343
    (0.000  (0


 Press return to continue.