Aller au contenu

Mathc initiation/Fichiers c : c60cc

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 = surface_dydx(  f,  g,
                          u,  v,LOOP,   
                          ax,bx,LOOP);
 clrscrn();                           
                                      
 printf(" Evaluate this surface integral.\n\n");
 printf("  //                  \n");
 printf(" ||                   \n");
 printf(" ||f(x,y,g(x,y)) sqrt[g_x(x,y)^2+g_y(x,y)^2+1] dydx = %.3f\n",m);
 printf(" ||                   \n");
 printf("//                    \n");
 printf("Ryx               \n\n\n");
 
 printf(" f : (x,y,z)-> %s\n\n", feq);
 printf(" g :   (x,y)-> %s\n\n", geq);

 printf(" v :     (x)-> %s  \n", veq);
 printf(" u :     (x)-> %s\n\n", ueq); 
 
 printf(" b = %+.1f\n a = %+.1f\n\n\n",bx,ax);
 stop();

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

L'algorithme consiste à adapter la fonction qui calcule les intégrales doubles au calcul des surfaces en 3d.

Exemple de sortie écran :
 Evaluate this surface integral.

  //                  
 ||                   
 ||f(x,y,g(x,y)) sqrt[g_x(x,y)^2+g_y(x,y)^2+1] dydx = 25.256
 ||                   
//                    
Ryx               


 f : (x,y,z)-> x+y+z

 g :   (x,y)-> 6-2*x-3*y

 v :     (x)-> (6-3*x)/2  
 u :     (x)-> 0

 b = +3.0
 a = +0.0


 Press return to continue.
 Sortie écran d'un CAS :
> restart:
> 
> f := (x,y,z)->x+y+z:
> g := (x,y)-> 6-2*x-3*y:
> Int(
> Int(
>       f(x,y,g(x,y))*
>    sqrt( diff(g(x,y),x)^2 + diff(g(x,y),y)^2 + 1),
> 
> y = 0 .. (6-3*x)/2),
> x = 0 .. 3);

              3    3 - 3/2 x
             /    /
            |    |
            |    |           (-x - 2 y + 6) sqrt(14) dy dx
            |    |
           /    /
             0    0

> evalf(value(%));
> 

                             25.25618736

>