Aller au contenu

Mathc initiation/Fichiers c : c23cb

Un livre de Wikilivres.


Sommaire


Installer et compiler ces fichiers dans votre répertoire de travail.

c3b.c
/* --------------------------------- */
/* save as c3b.c                     */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fb.h"
/* --------------------------------- */
int main(void)
{
double c  = .5;

 clrscrn();
 printf("  f : x-> %s\n\n" 
        " Df : x-> %s\n\n\n", feq, Dfeq);

 printf("  Compute the derivative of f when x = %0.3f\n\n", c);   
  
 printf("  with   Df(%0.3f) = %0.8f    \n",c, Df(c));
 printf("  with fx_x(%0.3f) = %0.8f\n\n\n",c, fx_x(f,c,H));
 stop();
 
 clrscrn();
 printf("  The equation of the tangente \n\n"); 
 eq_Tan(c, f, Df);
 
 printf("  The equation of the tangente (with the function : fx_x();)\n\n"); 
 eq_tan(c, f);  
 stop();
 
 clrscrn();
 printf("  The equation of the normal \n\n"); 
 eq_Norm(c, f, Df);
 
 printf("  The equation of the normal (with the function : fx_x();)\n\n"); 
 eq_norm(c, f); 
 
 stop();

 return 0;
}
/* ---------------------------------- */
/* ---------------------------------- */


Vérifions notre travail avec gnuplot.

Fichier de commande gnuplot :
# ---------------------
# Copy and past this file into the screen of gnuplot
#
#
set zeroaxis lt 3 lw 1
set grid
plot [ -3.:3.] [-2.:2.]\
                cos(x),\
      -0.479*x +1.1170,\
        2.086*x -0.165
reset
# ---------------------


Exemple de sortie écran :

  f : x->  cos(x)

 Df : x->  (-sin(x)) 


  Compute the derivative of f when x = 0.500

  with   Df(0.500) = -0.47942554    
  with fx_x(0.500) = -0.47942554


 Press return to continue. 


*********************************


  The equation of the tangente 

 -0.479*x +1.117


  The equation of the tangente (with the function : fx_x();)

 -0.479*x +1.117


 Press return to continue. 


*********************************


  The equation of the normal 

 2.086*x -0.165


  The equation of the normal (with the function : fx_x();)

 2.086*x -0.165


 Press return to continue.