Mathc initiation/c35a7

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_zxy.h
'
/* ---------------------------------- */
/* save as x_zxy.h                   */
/* --------------------------------- */
double intz_dzdxdy(
double (*P_f)(double x, double y, double z),
double y,
double x,

double (*Puz)(double x, double y),
double (*Pvz)(double x, double y),
   int    nz
)
{
   int i = 0;
double m = 0.;
double M = 0.;

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

  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) / (2*nz) );
}
/* --------------------------------- */
double intx_dzdxdy(
double (*P_f)(double x, double y, double z),
double y,

double (*Psx)(double y),
double (*Ptx)(double y),
   int    nx,
   
double (*Puz)(double x, double y),
double (*Pvz)(double x, double y),
   int    nz
)
{
   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 * intz_dzdxdy(      (*P_f),
                                  y,
                           (((*Psx)(y))+i*(((*Ptx)(y))-((*Psx)(y)))/nx),
                             (*Puz),
                             (*Pvz),
                               nz);
 }

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

double ay,
double by,
   int ny,
   
double (*Psx)(double y),
double (*Ptx)(double y),
   int    nx,
   
double (*Puz)(double x, double y),
double (*Pvz)(double x, double y),
   int    nz
)
{
   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 * intx_dzdxdy(        (*P_f),
                             (ay+i*(by-ay)/ny),
                             (*Psx),
                             (*Ptx),
                               nx,
                             (*Puz),
                             (*Pvz),
                               nz);
 }

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


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