Mathc initiation/c36a5

Un livre de Wikilivres.
Aller à la navigation Aller à la recherche


Sommaire


Installer ce fichier dans votre répertoire de travail.

Crystal Clear mimetype source h.png x_yxz.h
'
/* ---------------------------------- */
/* save as x_yxz.h                   */
/* --------------------------------- */
double inty_dydxdz(
double (*P_f)(double x, double y, double z),

double z,

double x,

double (*Puy)(double x, double z),
double (*Pvy)(double x, double z),
   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 * (*P_f)( x, ((*Puy)(x,z)) + i*(((*Pvy)(x,z))-((*Puy)(x,z)))/ny, z);
 }

  return( ((((*Pvy)(x,z)) -((*Puy)(x,z)))*M) / (3*ny) );
}
/* --------------------------------- */
double intx_dydxdz(
double (*P_f)(double x, double y, double z),

double z,

double (*Psx)(double z),
double (*Ptx)(double z),
   int    nx,
   
double (*Puy)(double x, double z),
double (*Pvy)(double x, double z),
   int    ny
)
{
   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 *      inty_dydxdz((*P_f),
                                z,
                                
                           (((*Psx)(z))+i*(((*Ptx)(z))-((*Psx)(z)))/nx),
                           
                             (*Puy),
                             (*Pvy),
                                ny);
 }

 return( ((((*Ptx)(z)) -((*Psx)(z)))*M) / (3*nx) );
}
/* --------------------------------- */
double sympson_dydxdz(
double (*P_f)(double x, double y, double z),

double az,
double bz,
   int nz,
   
double (*Psx)(double x),
double (*Ptx)(double x),
   int    nx,
   
double (*Puy)(double x, double z),
double (*Pvy)(double x, double z),
   int    ny
)
{
   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 *        intx_dydxdz((*P_f),
  
                             (az+i*(bz-az)/nz),
                             
                             (*Psx),
                             (*Ptx),
                                nx,
                               
                             (*Puy),
                             (*Pvy),
                                ny);
 }

  return( ((bz -az)*M) / (3*nz) );
}
/* --------------------------------- */
/* --------------------------------- */