Aller au contenu

Mathc initiation/c36a7

Un livre de Wikilivres.


SommaireUtilise la commande "Retour en Arrière" de ton navigateur.


Installer ce fichier dans votre répertoire de travail.

x_zxy.h
/* ---------------------------------- */
/* save as x_zxy.h                   */
/* --------------------------------- */
double intz_dzdxdy(
double (*P_f)(double x, double y, double z),

double (*Puz)(double x, double y),
double (*Pvz)(double x, double y),
   int    nz,

double x,

double y
)
{
   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= nz; i++)
 {
       if(i ==0 || i== nz){m = 1.;}
  else if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

  M += m * (*P_f)( x, y, ((*Puz)(x,y)) + i*(((*Pvz)(x,y))-((*Puz)(x,y)))/nz);
 }

  return( ((((*Pvz)(x,y)) -((*Puz)(x,y)))*M) / (3*nz) );
}
/* --------------------------------- */
double intx_dzdxdy(
double (*P_f)(double x, double y, double z),
   
double (*Puz)(double x, double y),
double (*Pvz)(double x, double y),
   int    nz,

double (*Psx)(double y),
double (*Ptx)(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 if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

  M += m * intz_dzdxdy(      (*P_f),
                           
                             (*Puz),
                             (*Pvz),
                                nz,
                                
                           (((*Psx)(y))+i*(((*Ptx)(y))-((*Psx)(y)))/nx),
                           
                                y);
 }

 return( ((((*Ptx)(y)) -((*Psx)(y)))*M) / (3*nx) );
}
/* --------------------------------- */
double simpson_dzdxdy(
double (*P_f)(double x, double y, double z),
   
double (*Puz)(double x, double y),
double (*Pvz)(double x, double y),
   int    nz,
   
double (*Psx)(double y),
double (*Ptx)(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 if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

  M += m * intx_dzdxdy(      (*P_f),
                               
                             (*Puz),
                             (*Pvz),
                                nz,
                             
                             (*Psx),
                             (*Ptx),
                                nx,
  
                             (ay+i*(by-ay)/ny));
 }

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


Les fonctions pour calculer les intégrales de la forme dzdxdy