Aller au contenu

Mathc initiation/Fichiers c : c54cc

Un livre de Wikilivres.


Sommaire

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

c18cyx.c
/* --------------------------------- */
/* save as c18cyx.c                  */
/* --------------------------------- */
#include  "x_afile.h"
#include       "fc.h"
/* --------------------------------- */
int main(void)
{
 clrscrn(); 
 printf(" The Green's theorem :   \n\n");
 
 printf("    (                            (b   (y1(x)             \n" 
        " int( M(x,y) dx + N(x,y) dy = int( int( (N_x - M_y) dy dx\n"
        "    (c                           (a   (y0(x)     \n\n\n\n\n");
 
 printf(" Use the Green's theorem to evaluate :   \n\n");  
 
 printf("    (                           (%.1f     (%s  \n",x1,y1eq);
 printf(" int( %s dx+%s dy = int(     int( %s dy dx\n",
                          Meq, Neq, N_x_mns_M_y_eq);
 printf("    (c                          (%.1f     (%s\n\n",x0,y0eq);         
 stop(); 
 
 clrscrn();     
 printf(" M(x,y) = %s \n",   Meq);
 printf(" N(x,y) = %s \n\n", Neq);

 printf(" N_x_mns_M_y(x,y) = %s  \n\n", N_x_mns_M_y_eq);
 
 printf(" y1(x) = %s   \n", y1eq); 
 printf(" y0(x) = %s \n\n", y0eq);

 printf(" With simpson_dydx().\n\n");
 printf("    (%.1f    (%s                \n", x1, y1eq);
 printf(" int(    int( %s  dy dx = %.5f\n", N_x_mns_M_y_eq, 
             simpson_dydx(N_x_mns_M_y, y0,y1,LOOP, x0,x1,LOOP) );
 printf("    (%.1f    (%s           \n\n\n", x0, y0eq);
 
 printf(" With green_dydx().\n\n");
 printf("    (%.1f    (%s                         \n", x1, y1eq);
 printf(" int(    int( (N_x - M_y)  dy dx = %.5f\n", 
             green_dydx(M,N, y0,y1,LOOP, x0,x1,LOOP) );
 printf("    (%.1f    (%s                     \n\n\n", x0, y0eq);

 stop();

 return 0;
}
/* --------------------------------- */
/* --------------------------------- */

Nous avons une fonction pour calculer directement l'intégrale double de Green. Elle calcule elle même les dérivées partielles nécessaires.

Exemple de sortie écran :

 The Green's theorem :   

    (                            (b   (y1(x)             
 int( M(x,y) dx + N(x,y) dy = int( int( (N_x - M_y) dy dx
    (c                           (a   (y0(x)     




 Use the Green's theorem to evaluate :   

    (                           (2.0     (2*x  
 int( (5*x*y) dx+(x**3) dy = int(     int( (3*x**2)-(5*x) dy dx
    (c                          (0.0     (x**2

 Press return to continue. 


 M(x,y) = (5*x*y) 
 N(x,y) = (x**3) 

 N_x_mns_M_y(x,y) = (3*x**2)-(5*x)  

 y1(x) = 2*x   
 y0(x) = x**2 

 With simpson_dydx().

    (2.0    (2*x                
 int(    int( (3*x**2)-(5*x)  dy dx = -1.86667
    (0.0    (x**2           


 With green_dydx().

    (2.0    (2*x                         
 int(    int( (N_x - M_y)  dy dx = -1.86667
    (0.0    (x**2                     


 Press return to continue.