Mathc initiation/Fichiers c : c23ca
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c3a.c |
---|
/* --------------------------------- */
/* save as c3a.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fa.h"
/* --------------------------------- */
int main(void)
{
double c = 1;
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;
}
/* ---------------------------------- */
/* ---------------------------------- */
Dessinons la tangente et la normale, pour vérifier la qualité de notre fonction fx_x();.
set size ratio -1
La commande ci-dessus est importante pour que la normale soit bien perpendiculaire à la tangente.
Fichier de commande gnuplot :
# ---------------------
# Copy and past this file into the screen of gnuplot
#
#
set size ratio -1
set zeroaxis lt 3 lw 1
set grid
plot [ -4.:4.] [-7.:1.]\
3.0*x**2 - 2.0*x - 5.0,\
4.000*x -8.000,\
-0.250*x -3.750
reset
# ---------------------
Exemple de sortie écran :
f : x-> 3.0*x**2 - 2.0*x - 5.0
Df : x-> 6.0*x - 2.0
Compute the derivative of f when x = 1.000
with Df(1.000) = 4.00000000
with fx_x(1.000) = 4.00000000
Press return to continue.
**********************
The equation of the tangente
4.000*x -8.000
The equation of the tangente (with the function : fx_x();)
4.000*x -8.000
Press return to continue.
**********************
The equation of the normal
-0.250*x -3.750
The equation of the normal (with the function : fx_x();)
-0.250*x -3.750
Press return to continue.