Mathc initiation/c35a7
Apparence
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 {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 (*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 {m = 2.;}
M += m * intz_dzdxdy( (*P_f),
(*Puz),
(*Pvz),
nz,
(((*Psx)(y))+i*(((*Ptx)(y))-((*Psx)(y)))/nx),
y);
}
return( ((((*Ptx)(y)) -((*Psx)(y)))*M) / (2*nx) );
}
/* --------------------------------- */
double trapezoid_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 {m = 2.;}
M += m * intx_dzdxdy( (*P_f),
(*Puz),
(*Pvz),
nz,
(*Psx),
(*Ptx),
nx,
(ay+i*(by-ay)/ny));
}
return( ((by -ay)*M) / (2*ny) );
}
/* --------------------------------- */
Les fonctions pour calculer les intégrales de la forme dzdxdy