Aller au contenu

Mathc initiation/Fichiers c : c54cd

Un livre de Wikilivres.


Sommaire

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

c18dxy.c
/* --------------------------------- */
/* save as c18dxy.c                  */
/* --------------------------------- */
#include  "x_afile.h"
#include      "fd.h"
/* --------------------------------- */
int main(void)
{
 clrscrn(); 
 printf(" The Green's theorem :   \n\n");
 
 printf("    (                            (b   (x1(x)             \n" 
        " int( M(x,y) dx + N(x,y) dy = int( int( (N_x - M_y) dx dy\n"
        "    (c                           (a   (x0(x)     \n\n\n\n\n");
 
 printf(" Use the Green's theorem to evaluate :   \n\n");  
 
 printf("    (                                (%.1f   (%s\n",    Y1, x1eq);
 printf(" int( %s dx + %s dy = int(   int( %s dx dy\n", 
                       Meq, Neq, N_x_mns_M_y_eq);
 printf("    (c                               (%.1f  (%s\n\n\n\n\n", Y0, x0eq);         
 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(" x0(x) = %s   \n", x1eq); 
 printf(" x1(x) = %s \n\n", x0eq);

 printf(" With simpson_dxdy().\n\n");
 printf("    (%.1f    (%s\n", Y1, x1eq);
 printf(" int(    int( %s  dx dy = %.5f\n", N_x_mns_M_y_eq, 
             simpson_dxdy(N_x_mns_M_y, x0,x1,LOOP, Y0,Y1,LOOP) );
 printf("    (%.1f   (%s\n\n\n", Y0, x0eq);
 
  printf(" With green_dxdy().\n\n");
 printf("    (%.1f    (%s\n", Y1, x1eq);
 printf(" int(    int( (N_x - M_y)  dx dy = %.5f\n", 
             green_dxdy(M,N, x0,x1,LOOP, Y0,Y1,LOOP) );
 printf("    (%.1f  (%s\n\n\n", Y0, x0eq);

 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   (x1(x)             
 int( M(x,y) dx + N(x,y) dy = int( int( (N_x - M_y) dx dy
    (c                           (a   (x0(x)     




 Use the Green's theorem to evaluate :   

    (                                (0.0   (-y
 int( (x**2+y) dx + (x*y**2) dy = int(   int( (y**2)-1 dx dy
    (c                               (-1.0  (y**2




 Press return to continue. 


 M(x,y) = (x**2+y) 
 N(x,y) = (x*y**2) 

 N_x_mns_M_y(x,y) = (y**2)-1  

 x0(x) = -y   
 x1(x) = y**2 

 With simpson_dxdy().

    (0.0    (-y
 int(    int( (y**2)-1  dx dy = -0.11667
    (-1.0   (y**2


 With green_dxdy().

    (0.0    (-y
 int(    int( (N_x - M_y)  dx dy = -0.11667
    (-1.0  (y**2


 Press return to continue.