Aller au contenu

Mathc initiation/Fichiers c : c23ce

Un livre de Wikilivres.
Version datée du 7 juillet 2021 à 18:01 par Xhungab (discussion | contributions) (petit correction)
(diff) ← Version précédente | Voir la version actuelle (diff) | Version suivante → (diff)


Sommaire


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