Aller au contenu

Mathc initiation/a312

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

x_fdzdx.h
/* ---------------------------------- */
/* save as x_fdzdx.h                  */
/* ---------------------------------- */
double IntFlux_dzdx(

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_h)(double x, double z),

pt2d  p
)
{
v3d n = n_norm_grad_dxdz((*P_h), p);

 return( ( n.i*(*P_M)(p.x, (*P_h)(p.x,p.y), p.y ) +
           n.j*(*P_N)(p.x, (*P_h)(p.x,p.y), p.y ) +
           n.k*(*P_P)(p.x, (*P_h)(p.x,p.y), p.y ) ) *

          sqrt( pow(fxy_x((*P_h),H,p),2) +
                pow(fxy_y((*P_h),H,p),2) +
                                      1)
             );
}
/* ---------------------------------- */
double   IntFlux_simpson_dzdxt(

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

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

  M += l * IntFlux_dzdx((*P_M),(*P_N),(*P_P),
                        (*P_h),
                          p);
 }

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

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

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

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


Déclaration des fichiers h.