Installer et compiler ces fichiers dans votre répertoire de travail.
![]() |
c3e.c ' |
---|
/* --------------------------------- */
/* save as c3e.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fb.h"
/* --------------------------------- */
int main(void)
{
double c = .5;
double h = .00001;
clrscrn();
printf(" f : x-> %s\n\n"
" Df2 : x-> %s\n\n\n", feq, Dfeq2);
printf(" Compute the second derivative of f when x = %0.3f\n\n", c);
printf(" with Df2(%0.3f) = %0.8f \n",c, Df2(c));
printf(" with fx_xx(%0.3f) = %0.8f\n\n",c, fx_xx(f,c,h));
stop();
return 0;
}
Essayez avec h = .1, h = .01, h = .001, h = .0001, h = .00001 pour observer l'augmentation de la précision des calculs.
Exemple de sortie écran :
f : x-> cos(x)
Df2 : x-> (-cos(x))
Compute the second derivative of f when x = 0.500
with Df2(0.500) = -0.87758256
with fx_xx(0.500) = -0.87758356
Press return to continue
Cet article est issu de Wikibooks. Le texte est sous licence Creative Commons - Attribution - Partage dans les Mêmes. Des conditions supplémentaires peuvent s'appliquer aux fichiers multimédias.