Mathc initiation/a477
Installer ce fichier dans votre répertoire de travail.
x_juwv.h |
---|
/* --------------------------------- */
/* save as x_juwv.h */
/* --------------------------------- */
double J_x_uwv(
double (*P_f)(double x, double y, double z),
double (*P_X)(double x, double y, double z),
double (*P_Y)(double x, double y, double z),
double (*P_Z)(double x, double y, double z),
double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
int nx,
double z,
double y
)
{
pt3d p;
double x = 0;
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.;}
x = ((*Pux)(y,z)) + i*(((*Pvx)(y,z))-((*Pux)(y,z)))/nx;
p.x = x;
p.y = y;
p.z = z;
M += m * (*P_f)( ((*P_X)(x,y,z)),
((*P_Y)(x,y,z)),
((*P_Z)(x,y,z)))
*
/* Jacobian */
fabs(
fxyz_x((*P_X),H,p)
*
( fxyz_y((*P_Y),H,p)*fxyz_z((*P_Z),H,p)
-
fxyz_z((*P_Y),H,p)*fxyz_y((*P_Z),H,p) )
-
fxyz_y((*P_X),H,p)
*
( fxyz_x((*P_Y),H,p)*fxyz_z((*P_Z),H,p)
-
fxyz_z((*P_Y),H,p)*fxyz_x((*P_Z),H,p) )
+
fxyz_z((*P_X),H,p)
*
( fxyz_x((*P_Y),H,p)*fxyz_y((*P_Z),H,p)
-
fxyz_y((*P_Y),H,p)*fxyz_x((*P_Z),H,p) )
);
}
return( ((((*Pvx)(y,z)) -((*Pux)(y,z)))*M) / (3*nx) );
}
/* --------------------------------- */
double J_z_uwv(
double (*P_f)(double x, double y, double z),
double (*P_X)(double x, double y, double z),
double (*P_Y)(double x, double y, double z),
double (*P_Z)(double x, double y, double z),
double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
int nx,
double (*Psz)(double x),
double (*Ptz)(double x),
int nz,
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 * J_x_uwv( (*P_f),
(*P_X),(*P_Y),(*P_Z),
(*Pux),(*Pvx),nx,
(((*Psz)(y))+i*(((*Ptz)(y))-((*Psz)(y)))/nz),
y);
}
return( ((((*Ptz)(y)) -((*Psz)(y)))*M) / (3*nz) );
}
/* --------------------------------- */
double J_uwv(
double (*P_f)(double x, double y, double z),
double (*P_X)(double x, double y, double z),
double (*P_Y)(double x, double y, double z),
double (*P_Z)(double x, double y, double z),
double (*Pux)(double y, double z),
double (*Pvx)(double y, double z),
int nx,
double (*Psz)(double x),
double (*Ptz)(double x),
int nz,
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 * J_z_uwv( (*P_f),
(*P_X),(*P_Y),(*P_Z),
(*Pux),(*Pvx),nx,
(*Psz),(*Ptz),nz,
(ay+i*(by-ay)/ny));
}
return( ((by -ay)*M) / (3*ny) );
}
/* --------------------------------- */
/* --------------------------------- */
----