Mathc initiation/Fichiers h : c26a4
Apparence
Sommaire ◀ Utilise la commande "Retour en Arrière" de ton navigateur.
Installer ce fichier dans votre répertoire de travail.
x_fxyz.h utilitaire |
---|
/* --------------------------------- */
/* save as x_fxyz.h */
/* --------------------------------- */
double fxyz_x(
double (*P_f)(double x, double y, double z),
double h,
pt3d p
)
{
double tplsh;
double tmnsh;
tplsh = ((*P_f)(p.x+h,p.y,p.z));
tmnsh = ((*P_f)(p.x-h,p.y,p.z));
return(( tplsh-tmnsh)/(2.*h) );
}
/* --------------------------------- */
double fxyz_y(
double (*P_f)(double x, double y, double z),
double h,
pt3d p
)
{
double tplsh;
double tmnsh;
tplsh = ((*P_f)(p.x,p.y+h,p.z));
tmnsh = ((*P_f)(p.x,p.y-h,p.z));
return(( tplsh-tmnsh)/(2.*h) );
}/* --------------------------------- */
double fxyz_z(
double (*P_f)(double x, double y, double z),
double h,
pt3d p
)
{
double tplsh;
double tmnsh;
tplsh = ((*P_f)(p.x,p.y,p.z+h));
tmnsh = ((*P_f)(p.x,p.y,p.z-h));
return(( tplsh-tmnsh)/(2.*h) );
}
/* --------------------------------- */
double fxyz_xx(
double (*P_f)(double x, double y, double z),
double h,
pt3d p
)
{
double t;
double tplsh;
double tmnsh;
t = ((*P_f)(p.x , p.y,p.z));
tplsh = ((*P_f)(p.x+h, p.y,p.z));
tmnsh = ((*P_f)(p.x-h, p.y,p.z));
return( (tplsh-2*t+tmnsh)/(h*h) );
}
/* --------------------------------- */
double fxyz_yy(
double (*P_f)(double x, double y, double z),
double h,
pt3d p
)
{
double t;
double tplsh;
double tmnsh;
t = ((*P_f)(p.x, p.y ,p.z));
tplsh = ((*P_f)(p.x, p.y+h,p.z));
tmnsh = ((*P_f)(p.x, p.y-h,p.z));
return( (tplsh-2*t+tmnsh)/(h*h) );
}
/* --------------------------------- */
double fxyz_zz(
double (*P_f)(double x, double y, double z),
double h,
pt3d p
)
{
double t;
double tplsh;
double tmnsh;
t = ((*P_f)(p.x,p.y,p.z ));
tplsh = ((*P_f)(p.x,p.y,p.z+h));
tmnsh = ((*P_f)(p.x,p.y,p.z-h));
return( (tplsh-2*t+tmnsh)/(h*h) );
}
/* --------------------------------- */
/* --------------------------------- */
Dans ce fichier il y a les fonctions pour calculer les dérivées partielles.
Les méthodes de calculs :
First partial derivatives.
f_x = [f(x+h,y,z)-f(x-h,y,z)]/2h
f_y = [f(x,y+h,z)-f(x,y-h,z)]/2h
f_z = [f(x,y,z+h)-f(x,y,z-h)]/2h
Second partial derivatives.
f_xx = [f(x+h,y,z)-2f(x,y,z)+f(x-h,y,z)]/h**2
f_yy = [f(x,y+h,z)-2f(x,y,z)+f(x,y-h),z]/h**2
f_zz = [f(x,y,z+h)-2f(x,y,z)+f(x,y,z-h)]/h**2