Sommaire


Installer ce fichier dans votre répertoire de travail.


x_dxdy.h
/* ---------------------------------- */
/* save as x_dxdy.h                  */
/* ---------------------------------- */
double int_dx(
double (*P_f)(double x, double y),

double (*P_ax)(double y),         
double (*P_bx)(double y),         
   int     nx,
   
double y
)
{
   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= nx; i++)
 {
    if(i ==0 || i== nx){m = 1.;}
  else                 {m = 2.;}

  M += m * (*P_f)( ((*P_ax)( y)) + i*(((*P_bx)( y))-((*P_ax)( y)))/nx, y);
 }                 

  return( ((((*P_bx)( y))-((*P_ax)( y)))*M) / (2*nx) );
}
/* ---------------------------------- */
double trapezoid_dxdy(
double (*P_f)(double x, double y),

double (*P_ax)(double y),
double (*P_bx)(double y),
   int     nx,
   
double ay,
double by,
   int ny
)
{
   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= ny; i++)
 {
    if(i ==0 || i== ny){m = 1.;}
  else                 {m = 2.;}

  M += m * int_dx((*P_f), (*P_ax),(*P_bx),nx, (ay+i*(by-ay)/ny));
 }                               

  return( ((by-ay)*M) / (2*ny) );
}
/* ---------------------------------- */
/* ---------------------------------- */


Les fonctions pour calculer les intégrales de la forme dxdy.