Aller au contenu

Mathc initiation/Fichiers c : c64cc

Un livre de Wikilivres.


Sommaire

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

c00c.c
/* --------------------------------- */
/* save as c00c.c                    */
/* --------------------------------- */
#include "x_afile.h"
#include      "fc.h"
/* --------------------------------- */
int main(void)
{
double m = flux_dydzdx(  M,N,P,
                         Y0, Y1,LOOP,
                         z0, z1,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  / z1(x)  / y1(x, z)                     \n");
 printf("    |     |       |                                \n");
 printf("    |     |       | M_x + N_y + P_z dydzdx = %.3f  \n",m);
 printf("    |     |       |                                \n");
 printf("   /  x0 /   z0(x) /  y0(x, z)                 \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(" y1 :   (x,z)-> %s      \n", y1eq);
 printf(" y0 :   (x,z)-> %s    \n\n", y0eq);

 printf(" z1 :     (x)-> %s      \n", z1eq);
 printf(" z0 :     (x)-> %s    \n\n", z0eq);
 
 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"
        "  (x**3 + sin(z))_x =  (3 x**2)   \n"
        " (x^2*y + cos(z))_y =    (x**2)   \n"
        " (exp(x^2 + y^2))_z =       (0) \n\n"
        
        "          ((3 x**2)+(x**2)+(0))  \n\n"  
              
        " Code Mathematica : S = %.3f    \n\n"
        " integral ((3 x**2)+(x**2)+(0)) dy dz dx"
        " from (0) to (5-z) from -2 to 2 from 0 to (4-x**2)\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  / z1(x)  / y1(x, z)                     
    |     |       |                                
    |     |       | M_x + N_y + P_z dydzdx = 131.657  
    |     |       |                                
   /  x0 /   z0(x) /  y0(x, z)                 


 With.


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

 y1 :   (x,z)-> 5-z      
 y0 :   (x,z)-> +0    

 z1 :     (x)-> 4-x^2      
 z0 :     (x)-> +0    

 x1 :        -> +2      
 x0 :        -> -2    

 Press return to continue. 


 With.


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

 Compute the partial derivative M_x, N_y, P_z:

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

          ((3 x**2)+(x**2)+(0))  

 Code Mathematica : S = 131.657    

 integral ((3 x**2)+(x**2)+(0)) dy dz dx from (0) to (5-z) from -2 to 2 from 0 to (4-x**2)

 Press return to continue.