Aller au contenu

Mathc initiation/Fichiers h : c54a8

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.


x_gdydx.h
/* ---------------------------------- */
/* save as x_gdydx.h                   */
/* ---------------------------------- */
double gint_dy(
double (*P_M)(double x, double y),
double (*P_N)(double x, double y),

double (*P_u)(double x),
double (*P_v)(double x),
   int ny,
   
double x
)
{
   int i = 0;
double m = 0.;
double M = 0.;

pt2d  t;

 for(i = 0; i <= ny; i++)
 {
       if(i ==0 || i== ny){m = 1.;}
  else if(fmod(i,2) == 0 ){m = 2.;}
  else                    {m = 4.;}
  
  t.x = x;
  t.y = ((*P_u)(x)) + i*(((*P_v)(x))-((*P_u)(x)))/ny;

  M += m * ( fxy_x((*P_N),H,t)-
             fxy_y((*P_M),H,t) ) ;
 }

  return( ((((*P_v)(x)) -((*P_u)(x)))*M) / (3*ny) );
}
/* ---------------------------------- */
double green_dydx(
double (*P_M)(double x, double y),
double (*P_N)(double x, double y),
   
double (*P_u)(double x),
double (*P_v)(double x),
   int ny,

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

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


Déclaration des fichiers h.