Mathc initiation/Fichiers h : c62a8


Sommaire


Installer ce fichier dans votre répertoire de travail.

x_fdydx.h
/* ---------------------------------- */
/* save as x_fdydx.h                  */
/* ---------------------------------- */
double IntFlux_dydx(

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_f)(double x, double y),

pt2d p
)
{
 return( ( -fxy_x((*P_f),H,p)*(*P_M)(p.x, p.y, (*P_f)(p.x,p.y)) +
           -fxy_y((*P_f),H,p)*(*P_N)(p.x, p.y, (*P_f)(p.x,p.y)) +
                              (*P_P)(p.x, p.y, (*P_f)(p.x,p.y)) ) 
             );
}
/* ---------------------------------- */
double   IntFlux_simpson_dydxt(

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_f)(double x, double y),

double (*P_u)(double y),
double (*P_v)(double y),
   int m,
   
double x
)
{
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.y = ((*P_u)(x)) + i*(((*P_v)(x))-((*P_u)(x)))/m;
        p.x = x;

  M += l * IntFlux_dydx((*P_M),
                        (*P_N),
                        (*P_P),
                        (*P_f),
                          p);
 }

  return( ((((*P_v)(x)) -((*P_u)(x)))*M) / (3*m) );
}
/* ---------------------------------- */
double IntFlux_simpson_dydx(

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_f)(double x, double y),

double (*P_u)(double y),
double (*P_v)(double y),
   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_dydxt( (*P_M),
                                  (*P_N),
                                  (*P_P),
                                  (*P_f),
                                  (*P_u),
                                  (*P_v),
                                    m,
                                   (a + i*(b-a)/n));
 }

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


Déclaration des fichiers h.