Aller au contenu

Mathc initiation/Fichiers c : c50c1a

Un livre de Wikilivres.


SommaireUtilise la commande "Retour en Arrière" de ton navigateur.


Installer ce fichier dans votre répertoire de travail.

x_cylkzr.h
/* -------------------------------- */
/* save as x_cylkzr.h               */
/* --------------------------------- */
double cylindrical_y_dydzdx(
double (*P_f)(double x, double y, double z),

double (*Puy)(double x, double z),
double (*Pvy)(double x, double z),
   int   ny,

double z,

double x
)
{
double y = 0;

   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.;}
  
  y = ((*Puy)(x,z)) + i*(((*Pvy)(x,z))-((*Puy)(x,z)))/ny;
  
  M += m * (*P_f)( x, y, z) * x;
 }

  return( ((((*Pvy)(x,z)) -((*Puy)(x,z)))*M) / (3*ny) );
}
/* --------------------------------- */
double cylindrical_z_dydzdx(
double (*P_f)(double x, double y, double z),
   
double (*Puy)(double x, double z),
double (*Pvy)(double x, double z),
   int   ny,

double (*Psz)(double x),
double (*Ptz)(double x),
   int   nz,

double x
)
{
   int i = 0;
double m = 0.;
double M = 0.;

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

  M += m * cylindrical_y_dydzdx(     (*P_f),
                           
                             (*Puy),
                             (*Pvy),
                               ny,
                                
                           (((*Psz)(x))+i*(((*Ptz)(x))-((*Psz)(x)))/nz),
                              x);
 }

 return( ((((*Ptz)(x)) -((*Psz)(x)))*M) / (3*nz) );
}
/* --------------------------------- */
double cylindrical_dkdzdr(
double (*P_f)(double x, double y, double z),
   
double (*Puy)(double x, double z),
double (*Pvy)(double x, double z),
   int   ny,
   
double (*Psz)(double x),
double (*Ptz)(double x),
   int   nz,

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 * cylindrical_z_dydzdx(      (*P_f),
                               
                             (*Puy),
                             (*Pvy),
                               ny,
                             
                             (*Psz),
                             (*Ptz),
                               nz,
  
                             (ax+i*(bx-ax)/nx));
 }

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


Déclaration des fichiers h.