Mathc initiation/Fichiers c : 81b

Un livre de Wikilivres.
Aller à la navigation Aller à la recherche


Sommaire

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

Crystal Clear mimetype source c.png c_b.c
/* ---------------------------------- */
/* save as c_b.c                      */
/* ---------------------------------- */
#include "x_hfile.h"

#include      "fb.h"
/* ---------------------------------- */
int main(void)
{
int      n =  2*30000;
double   a =  -100;
double   b =  1.;
double   M =  simpson(f,a,b,n);

 printf(" Improper integral with the Simpson's rule.\n\n");
 printf("      / b = %+.2f\n", b);
 printf("     |\n");
 printf("     |   %s dx = %.12f\n", feq, M);
 printf("     |\n");
 printf("    /  a = -oo\n\n");

 printf("                  e = %.12f\n\n", exp(1));

 for(a=1000; a>1;a/=10)
     printf(" a = %-12.0f  M = %.12f\n", -a, simpson(f,-a,b,n));

 printf(" \n\n" 
        "   In c language  -100 < -oo < -10 \n\n"); 
        
 stop();
 
 return 0;
}
/* ---------------------------------- */
/* ---------------------------------- */



Exemple de sortie écran :

 Improper integral with the Simpson's rule.

      / b = +1.00
     |
     |   exp(x) dx = 2.718281828459
     |
    /  a = -oo

                  e = 2.718281828459

 a = -1000         M = 2.718281829629
 a = -100          M = 2.718281828459
 a = -10           M = 2.718236428529
 

   In c language  -100 < -oo < -10 

 Press return to continue.