Sommaire


Installer ce fichier dans votre répertoire de travail.

x_length2d.h
/* --------------------------------- */
/* save as x_length2d.h              */
/* --------------------------------- */
double CurveLength2d(
double (*P_f)(double t),
double (*P_g)(double t),
double t
)
{
     return(  2. * PI * (*P_f)(t) * 
              sqrt( pow(fx_x((*P_f),t,H), 2)+
                    pow(fx_x((*P_g),t,H), 2)
                  )
           );
}
/* --------------------------------- */
double CurveLength2d_simpson(
double (*P_f)(double t),
double (*P_g)(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 * CurveLength2d( (*P_f), 
                          (*P_g),
                              t);
 }

  return( ((b -a)*M) / (3*n) );
}
/* --------------------------------- */