Aller au contenu

Mathc initiation/0043

Un livre de Wikilivres.


Sommaire

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

c00b4.c
/* --------------------------------- */
/* save as c00b4.c                   */
/* --------------------------------- */
#define  LOOP  2*100
/* --------------------------------- */
#include "x_afile.h"
#include     "fb4.h"
/* --------------------------------- */
int main(void)
{
double Ma = simpson(Ga,A0,A1,LOOP);
double Mb = simpson(Gb,B0,B1,LOOP);
double Mr = simpson(Gr,R0,R1,LOOP);

 clrscrn();
 
 printf(" If the variables are separable,\n"
        " you can use the product of three simple integrals,\n"
        " instead of a triple integral\n\n");
        
 printf("          (%s\n"
        " Ma  = int(   %s  da = %.6f\n"
        "          (%s\n\n",    A1eq, Gaeq, Ma, A0eq);

 printf("          (%s\n"
        " Mb  = int(   %s  db = %.6f\n"
        "          (%s\n\n\n",  B1eq, Gbeq, Mb, B0eq);
        
 printf("          (%s\n"
        " Mr  = int(   %s  dr = %.6f\n"
        "          (%s\n\n\n",  R1eq, Greq, Mr, R0eq);
        
 printf(" The result is  Ma * Mb * Mr = %.6f.\n\n", Ma * Mb * Mr);
        
 stop();

 return 0;
} 
/* ---------------------------------- */
/* ---------------------------------- */
a = xy;... ... b = zr;... ... r = r

Exemple de sortie écran :

 If the variables are separable,
 you can use the product of three simple integrals,
 instead of a triple integral

          (2*PI
 Ma  = int(   (1)  da = 6.283185
          (0

          (PI/2
 Mb  = int(   (cos(b)sin(b))  db = 0.500000
          (0


          (1
 Mr  = int(   (r r**2)  dr = 0.250000
          (0


 The result is  Ma * Mb * Mr = 0.785398.

 Press return to continue.