Mathc initiation/a140
Apparence
Installer ce fichier dans votre répertoire de travail.
x_length3d.h |
---|
/* --------------------------------- */
/* save as x_length3d.h */
/* --------------------------------- */
double CurveLength3d(
double (*P_f)(double t),
double (*P_g)(double t),
double (*P_h)(double t),
double t
)
{
return( sqrt(pow(fx_x((*P_f),t,H), 2)+
pow(fx_x((*P_g),t,H), 2)+
pow(fx_x((*P_h),t,H), 2)
)
);
}
/* --------------------------------- */
double CurveLength3d_simpson(
double (*P_f)(double t),
double (*P_g)(double t),
double (*P_h)(double t),
double a,
double b,
int n
)
{
int i = 0;
double m = 0.;
double M = 0.;
double t = 0.;
for(i = 0; i <= n; i++)
{
if(i ==0 || i== n){m = 1.;}
else if(fmod(i,2) == 0){m = 2.;}
else {m = 4.;}
t = (a + i*(b-a)/n);
M += m * CurveLength3d(
(*P_f),
(*P_g),
(*P_h),
t);
}
return( ((b -a)*M) / (3*n) );
}
/* --------------------------------- */
/* --------------------------------- */
Déclaration des fichiers h.