Mathc initiation/Fichiers h : c53a4


Sommaire

Installer ce fichier dans votre répertoire de travail.

Crystal Clear mimetype source h.png x_dydx.h
'
/* ---------------------------------- */
/* save as x_dydx.h                   */
/* ---------------------------------- */
double int_dy(
double (*P_f)(double x, double y),
double x,

double (*P_u)(double x),
double (*P_v)(double x),
   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 * (*P_f)(x,  ((*P_u)(x)) + i*(((*P_v)(x))-((*P_u)(x)))/ny);
 }

  return( ((((*P_v)(x)) -((*P_u)(x)))*M) / (3*ny) );
}
/* ---------------------------------- */
double simpson_dydx(
double (*P_f)(double x, double y),

double ax,
double bx,
   int nx,
   
double (*P_u)(double x),
double (*P_v)(double x),
   int ny)
{
   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 * int_dy((*P_f),(ax + i*(bx-ax)/nx),  (*P_u),(*P_v),ny);
 }

  return( ((bx -ax)*M) / (3*nx) );
}
/* ---------------------------------- */


Déclaration des fichiers h.