Mathc gnuplot/Fichiers h : xfxy x
Apparence
Préambule
[modifier | modifier le wikicode]Installez ce fichier dans votre répertoire de travail.
xfxy_x.h Dérivation de fonction df(x,y)/dx |
---|
/* ------------------------------------ */
/* Save as : xfxy_x.h */
/* ------------------------------------ */
double fxy_x(
double (*P_f)(double x, double y),
double h,
point2d p
)
{
double tplsh;
double tmnsh;
tplsh = ((*P_f)(p.x+h,p.y));
tmnsh = ((*P_f)(p.x-h,p.y));
return(( tplsh-tmnsh)/(2.*h) );
}
/* ------------------------------------ */
double fxy_y(
double (*P_f)(double x, double y),
double h,
point2d p
)
{
double tplsh;
double tmnsh;
tplsh = ((*P_f)(p.x,p.y+h));
tmnsh = ((*P_f)(p.x,p.y-h));
return(( tplsh-tmnsh)/(2.*h) );
}
/* ------------------------------------ */
double fxy_xx(
double (*P_f)(double x, double y),
double h,
point2d p
)
{
double t;
double tplsh;
double tmnsh;
t = ((*P_f)(p.x , p.y));
tplsh = ((*P_f)(p.x+h, p.y));
tmnsh = ((*P_f)(p.x-h, p.y));
return( (tplsh-2*t+tmnsh)/(h*h) );
}
/* ------------------------------------ */
double fxy_yy(
double (*P_f)(double x, double y),
double h,
point2d p
)
{
double t;
double tplsh;
double tmnsh;
t = ((*P_f)(p.x, p.y ));
tplsh = ((*P_f)(p.x, p.y+h));
tmnsh = ((*P_f)(p.x, p.y-h));
return( (tplsh-2*t+tmnsh)/(h*h) );
}