Aller au contenu

Mathc initiation/003c

Un livre de Wikilivres.


Sommaire

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

c00g1.c
/* --------------------------------- */
/* save as c00g1.c                   */
/* --------------------------------- */
#include  "x_afile.h"
#include      "fg1.h"
/* --------------------------------- */
int main(void)
{
double m = spheric_dadrdb( f,
                           a0, a1, LOOP,
                           r0, r1, LOOP,
                           b0, b1, LOOP);
 clrscrn();
 
 printf(" With spherical coordinates.\n\n\n");
 printf(" f   :   a,b,r -> %s                \n\n",   feq);

 printf(" a1  :     b,r -> %s                  \n",  a1eq);
 printf(" a0  :     b,r -> %s        [0..2PI]\n\n",  a0eq);

 printf(" r1  :       r -> %s                  \n",  r1eq);
 printf(" r0  :       r -> %s         [0..oo]\n\n",  r0eq);

 printf(" b1  :         -> %s                  \n",  b1eq);
 printf(" b0  :         -> %s         [0..PI]\n\n",  b0eq);
 
 printf("      (%s (%s    (%s      \n",                 b1eq,r1eq,a1eq);
 printf(" m=int(  int(  int( f(a,b,r) [r**2 sin(b)] dadrdb  = %.6f\n",m);
 printf("      (%s    (%s    (%s\n\n",                  b0eq,r0eq,a0eq);

 printf(" Code Mathematica : \n"
        " integral (r*cos(b))*(r**2 *sin(b)) da dr db"
        " from 0 to Pi/2 from 0 to (1) from 0 to (2*Pi)\n\n");     
 stop();

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

Exemple de sortie écran :

 With spherical coordinates.


 f   :   a,b,r -> (r cos(b))                

 a1  :     b,r -> 2PI                  
 a0  :     b,r -> 0        [0..2PI]

 r1  :       r -> 1                  
 r0  :       r -> 0         [0..oo]

 b1  :         -> PI/2                  
 b0  :         -> 0         [0..PI]

      (PI/2 (1    (2PI      
 m=int(  int(  int( f(a,b,r) [r**2 sin(b)] dadrdb  = 0.785398
      (0    (0    (0

 Code Mathematica : 
 integral (r*cos(b))*(r**2 *sin(b)) da dr db from 0 to Pi/2 from 0 to (1) from 0 to (2*Pi)

 Press return to continue.