Aller au contenu

Mathc initiation/a340

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

x_rzrxy.h
/* --------------------------------- */
/* save as x_rzrxy.h                 */
/* --------------------------------- */
double intxy_drdzrdxy(

double  (*P_P)(double r, double zr, double xy),

double (*P_ar)(double zr, double xy),
double (*P_br)(double zr, double xy),
   int nr,
   
double zr,
   
double xy
)
{
double r = 0;

   int i = 0;
double m = 0.;
double M = 0.;

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

  r = ((*P_ar)(zr,xy)) + i*(((*P_br)(zr,xy))-((*P_ar)(zr,xy)))/nr;
  
  M += m * (*P_P)( r, zr, xy)* r*r*sin(zr);

 }

  return( ((((*P_br)(zr,xy)) -((*P_ar)(zr,xy)))*M) / (3*nr) );
}
/* --------------------------------- */
double intzr_drdzrdxy(
double (*P_P)(double r, double zr, double xy),
   
double (*P_ar)(double zr, double xy),
double (*P_br)(double zr, double xy),
   int     nr,

double (*P_azr)(double xy),
double (*P_bzr)(double xy),
   int     nzr,
   
double     xy
)
{
   int i = 0;
double m = 0.;
double M = 0.;

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

  M += m *   intxy_drdzrdxy( (*P_P),
                           
                             (*P_ar),
                             (*P_br),
                                 nr,
                               
 (((*P_azr)(xy))+i*(((*P_bzr)(xy))-((*P_azr)(xy)))/nzr),
                               
                              xy);
 }

 return( ((((*P_bzr)(xy)) -((*P_azr)(xy)))*M) / (3*nzr) );
}
/* --------------------------------- */
double simpson_drdzrdxy(
double  (*P_P)(double r, double zr, double xy),
   
double (*P_ar)(double zr, double xy),
double (*P_br)(double zr, double xy),
   int     nr,
   
double (*P_azr)(double xy),
double (*P_bzr)(double xy),
   int     nzr,

double axy,
double bxy,
   int nxy
)
{
   int i = 0;
double m = 0.;
double M = 0.;

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

  M += m *     intzr_drdzrdxy((*P_P),
                               
                             (*P_ar),
                             (*P_br),
                                 nr,
                             
                             (*P_azr),
                             (*P_bzr),
                                 nzr,
                                
                             (axy+i*(bxy-axy)/nxy));
 }

  return( ((bxy -axy)*M) / (3*nxy) );
}
/* --------------------------------- */
/* --------------------------------- */


Déclaration des fichiers h.