Mathc initiation/Fichiers h : c62a9
Installer ce fichier dans votre répertoire de travail.
x_fdydz.h |
---|
/* ---------------------------------- */
/* save as x_fdydz.h */
/* ---------------------------------- */
double IntFlux_dydz(
double (*P_M)(double x, double y, double z),
double (*P_N)(double x, double y, double z),
double (*P_P)(double x, double y, double z),
double (*P_k)(double y, double z),
pt2d p
)
{
return( ( (*P_M)( (*P_k)(p.x,p.y), p.x, p.y ) +
-fxy_x((*P_k),H,p)*(*P_N)( (*P_k)(p.x,p.y), p.x, p.y ) +
-fxy_y((*P_k),H,p)*(*P_P)( (*P_k)(p.x,p.y), p.x, p.y ) )
);
}
/* ---------------------------------- */
double IntFlux_simpson_dydzt(
double (*P_M)(double x, double y, double z),
double (*P_N)(double x, double y, double z),
double (*P_P)(double x, double y, double z),
double (*P_k)(double y, double z),
double (*P_u)(double z),
double (*P_v)(double z),
int m,
double z
)
{
pt2d p;
int i = 0;
double l = 0.;
double M = 0.;
for(i = 0; i <= m; i++)
{
if(i ==0 || i== m){l = 1.;}
else if(fmod(i,2) == 0){l = 2.;}
else {l = 4.;}
p.x = ((*P_u)(z)) + i*(((*P_v)(z))-((*P_u)(z)))/m;
p.y = z;
M += l * IntFlux_dydz((*P_M),(*P_N),(*P_P),
(*P_k),
p);
}
return( ((((*P_v)(z)) -((*P_u)(z)))*M) / (3*m) );
}
/* ---------------------------------- */
double IntFlux_simpson_dydz(
double (*P_M)(double x, double y, double z),
double (*P_N)(double x, double y, double z),
double (*P_P)(double x, double y, double z),
double (*P_k)(double y, double z),
double (*P_u)(double z),
double (*P_v)(double z),
int m,
double a,
double b,
int n
)
{
int i = 0;
double l = 0.;
double M = 0.;
for(i = 0; i <= n; i++)
{
if(i ==0 || i== n){l = 1.;}
else if(fmod(i,2) == 0){l = 2.;}
else {l = 4.;}
M += l * IntFlux_simpson_dydzt( (*P_M),(*P_N),(*P_P),
(*P_k),
(*P_u),(*P_v),m,
(a + i*(b-a)/n));
}
return( ((b -a)*M) / (3*n) );
}
/* ---------------------------------- */
/* ---------------------------------- */
Déclaration des fichiers h.