Aller au contenu

Mathc initiation/Fichiers c : c64ca

Un livre de Wikilivres.


Sommaire

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

c00a.c
/* ---------------------------------- */
/* save as c00a.c                     */
/* ---------------------------------- */
#include "x_afile.h"
#include      "fa.h"
/* --------------------------------- */
int main(void)
{
double m = flux_dzdydx(  M,N,P,
                          z0, z1,LOOP,
                          y0, y1,LOOP,
                          x0, x1,LOOP);

 clrscrn();
 printf(" Use the divergence theorem to find,\n\n");

 printf(" the flux of F through S.\n\n");

 printf("     //            ///         \n");
 printf("    ||            |||          \n");
 printf("    || F.n dS  =  ||| div F dV \n");
 printf("    ||            |||          \n");
 printf("   //            ///           \n");
 printf("   S                   Q        \n\n\n");

 printf("      If F = Mi + Nj + Pk                    \n\n\n");

 printf("    ///             ///                      \n");
 printf("   |||             |||                       \n");
 printf("   ||| div F dV =  |||  M_x + N_y + P_z dV   \n");
 printf("   |||             |||                       \n");
 printf("  ///             ///                        \n");
 printf("   Q               Q                     \n\n\n");
 stop();

 clrscrn();

 printf("     / x1  / y1(x)  / z1(x, y)                       \n");
 printf("    |     |        |                                \n");
 printf("    |     |        | M_x + N_y + P_z dzdydx = %.3f  \n",m);
 printf("    |     |        |                                \n");
 printf("   /  x0 /   y0(x) /  z0(x, y)                   \n\n\n");

 printf(" With.\n\n\n");
 printf(" F : (x,y,z)-> (%s)i + (%s)j + (%s)k \n\n",Meq,Neq,Peq);

 printf(" z1 :   (x,y)-> %s      \n", z1eq);
 printf(" z0 :   (x,y)-> %s    \n\n", z0eq);
 
 printf(" y1 :     (x)-> %s      \n", y1eq);
 printf(" y0 :     (x)-> %s    \n\n", y0eq);
 
 printf(" x1 :        -> %s      \n", x1eq);
 printf(" x0 :        -> %s    \n\n", x0eq);
 stop();

 clrscrn();
 printf(" With.\n\n\n");
 printf(" F : (x,y,z)-> (%s)i + (%s)j + (%s)k \n\n",Meq,Neq,Peq);
 
 printf(" Compute the partial derivative M_x, N_y, P_z:\n\n"
        " (y*sin(x))_x = (y*(-cos(x)))   \n"
        "    (y^2*z)_y =       (2*y*z)   \n"
        "    (x+3*z)_z =           (3) \n\n"
        
        "          ((y*(-cos(x)))+(2*y*z)+(3))  \n\n"  
              
        " Code Mathematica : S = %.3f    \n\n"
        " integral ((y*(-cos(x)))+(2*y*z)+(3)) dz dx dy"
        " from (-1) to (1) from (-1) to (1)  from (-1) to (1)\n\n",m);
 stop();

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

Ce travail consiste à adapter l'intégrale triple au calcul du flux en 3d par le théorème de la divergence : (M_x + N_y + P_z)

 Exemple de sortie écran :
 Use the divergence theorem to find,

 the flux of F through S.

     //            ///         
    ||            |||          
    || F.n dS  =  ||| div F dV 
    ||            |||          
   //            ///           
   S                   Q        


      If F = Mi + Nj + Pk                    


    ///             ///                      
   |||             |||                       
   ||| div F dV =  |||  M_x + N_y + P_z dV   
   |||             |||                       
  ///             ///                        
   Q               Q                     


 Press return to continue. 


     / x1  / y1(x)  / z1(x, y)                       
    |     |        |                                
    |     |        | M_x + N_y + P_z dzdydx = 24.000  
    |     |        |                                
   /  x0 /   y0(x) /  z0(x, y)                   


 With.


 F : (x,y,z)-> (y*sin(x))i + (y^2*z)j + (x+3*z)k 

 z1 :   (x,y)-> +1      
 z0 :   (x,y)-> -1    

 y1 :     (x)-> +1      
 y0 :     (x)-> -1    

 x1 :        -> +1      
 x0 :        -> -1    

 Press return to continue. 


 With.


 F : (x,y,z)-> (y*sin(x))i + (y^2*z)j + (x+3*z)k 

 Compute the partial derivative M_x, N_y, P_z:

 (y*sin(x))_x = (y*(-cos(x)))   
    (y^2*z)_y =       (2*y*z)   
    (x+3*z)_z =           (3) 

          ((y*(-cos(x)))+(2*y*z)+(3))  

 Code Mathematica : S = 24.000    

 integral ((y*(-cos(x)))+(2*y*z)+(3)) dz dx dy from (-1) to (1) from (-1) to (1)  from (-1) to (1)

 Press return to continue.