Mathc initiation/c35a3
Apparence
Installer ce fichier dans votre répertoire de travail.
x_xyz.h |
---|
/* ---------------------------------- */
/* save as x_xyz.h */
/* --------------------------------- */
double intx_dxdydz(
double (*P_f)(double x, double y, double z),
double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
int nx,
double y,
double z
)
{
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)( (((*Pux)( y,z)) + i*(((*Pvx)( y,z))-((*Pux)( y,z)))/nx), y, z);
}
return( ((((*Pvx)( y,z)) -((*Pux)( y,z)))*M) / (2*nx) );
}
/* --------------------------------- */
double inty_dxdydz(
double (*P_f)(double x, double y, double z),
double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
int nx,
double (*Psy)(double x),
double (*Pty)(double x),
int ny,
double z
)
{
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_dxdydz( (*P_f),
(*Pux),
(*Pvx),
nx,
(((*Psy)(z))+i*(((*Pty)(z))-((*Psy)(z)))/ny),
z);
}
return( ((((*Pty)(z)) -((*Psy)(z)))*M) / (2*ny) );
}
/* --------------------------------- */
double trapezoid_dxdydz(
double (*P_f)(double x, double y, double z),
double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
int nx,
double (*Psy)(double x),
double (*Pty)(double x),
int ny,
double az,
double bz,
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 * inty_dxdydz( (*P_f),
(*Pux),
(*Pvx),
nx,
(*Psy),
(*Pty),
ny,
(az+i*(bz-az)/nz));
}
return( ((bz -az)*M) / (2*nz) );
}
/* --------------------------------- */
Les fonctions pour calculer les intégrales de la forme dxdydz