Mathc initiation/Fichiers h : c59ad


Sommaire


Installer ce fichier dans votre répertoire de travail.

Crystal Clear mimetype source h.png x_dxdy.h
'
/* ---------------------------------- */
/* save as x_dxdy.h                   */
/* ---------------------------------- */
double int_dx(
double (*P_f)(double x, double y),
double (*P_u)(double y),
double (*P_v)(double y),
   int nx,
   
double y
)
{
   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= nx; i++)
 {
       if(i ==0 || i== nx){m = 1.;}
  else if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

  M += m * (*P_f)(((*P_u)(y)) + i*(((*P_v)(y))-((*P_u)(y)))/nx, y);
 }

  return( ((((*P_v)(y)) -((*P_u)(y)))*M) / (3*nx) );
}
/* ---------------------------------- */
double simpson_dxdy(
double (*P_f)(double x, double y),
double (*P_u)(double y),
double (*P_v)(double y),
   int nx,
   
double ay,
double by,
   int ny
)
{
   int i = 0;
double m = 0.;
double M = 0.;

 for(i = 0; i <= ny; i++)
 {
       if(i ==0 || i== ny){m = 1.;}
  else if(fmod(i,2) == 0){m = 2.;}
  else                   {m = 4.;}

  M += m * int_dx((*P_f), (*P_u),(*P_v),nx,(ay+i*(by-ay)/ny));
 }

  return( ((by-ay)*M) / (3*ny) );
}
/* ---------------------------------- */
double simpson_drdk(
double (*P_f)(double x, double y),
double (*P_u)(double y),
double (*P_v)(double y),
   int nx,
   
double ay,
double by,
   int ny
)
{
 return( simpson_dxdy((*P_f),(*P_u),(*P_v),nx, ay,by,ny) );
}
/* ---------------------------------- */
/* ---------------------------------- */


Déclaration des fichiers h.