Sommaire


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


c17b.c
'
/* ---------------------------------- */
/* save as c17b.c                     */
/* ---------------------------------- */
#include  "x_hfile.h"
#include       "fb.h"
/* ---------------------------------- */
int main(void)
{
double a,b,n,
       ay,by,ny,
       Mxy,Myx;

 clrscrn();
 printf(" f : (x,y)-> %s\n\n\n", feq);

 a = 0;         ay =  0; 
 b = 2;         by =  3; 
 n = 2*45;      ny =  2*45;


 Myx = trapezoid_dydx(f,a,  b,  n,
                        ay, by, ny);

 Mxy = trapezoid_dxdy(f,a,  b,  n, 
                        ay, by, ny);


 printf(" With the trapezoidal's rule.\n\n");
 printf("    (%.3f  (%.3f\n",     b, by);
 printf(" int(   int(       %s  Dy Dx = %.6f\n", feq, Myx);
 printf("    (%.3f  (%.3f\n\n\n", a, ay);
 
 printf("    (%.3f  (%.3f\n",     by, b);
 printf(" int(   int(       %s  Dx Dy = %.6f\n", feq, Mxy);
 printf("    (%.3f  (%.3f\n\n\n", ay, a);

 stop();

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


Vous pouvez vérifier avec Octave version 5.2 :

I = dblquad (f, xa, xb, ya, yb)

>> I = dblquad (@(x, y) exp(-x.*x.*x-y.*y), 0, 2, 0, 3)

I =  0.79134


Exemple de sortie écran :

 f : (x,y)-> exp(-x**3-y**2)


 With the trapezoidal's rule.

    (2.000  (3.000
 int(   int(       exp(-x**3-y**2)  Dy Dx = 0.791342
    (0.000  (0.000


    (3.000  (2.000
 int(   int(       exp(-x**3-y**2)  Dx Dy = 0.791342
    (0.000  (0.000


 Press return to continue.
Cet article est issu de Wikibooks. Le texte est sous licence Creative Commons - Attribution - Partage dans les Mêmes. Des conditions supplémentaires peuvent s'appliquer aux fichiers multimédias.