Aller au contenu

Mathc initiation/Fichiers c : c52c1a

Un livre de Wikilivres.


Sommaire

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

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

 printf(" b1  :     a,r -> %s                  \n",  b1eq);
 printf(" b0  :     a,r -> %s         [0..PI]\n\n",  b0eq);

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

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

 printf(" Code Mathematica : \n"
        " integral (r*cos(b))*(r**2 *sin(b)) db dr da"
        " from 0 to (2*Pi) from 0 to (1) from 0 to Pi/2\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))                

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

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

 a1  :         -> 2*Pi                  
 a0  :         -> 0        [0..2PI]

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

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

 Press return to continue.