« Mathc gnuplot/Application : Tangente et axes x-y » : différence entre les versions

Contenu supprimé Contenu ajouté
Aucun résumé des modifications
Aucun résumé des modifications
Ligne 20 :
=== Dessiner ===
 
* {{Fichier|c01.c|largeur=70%|info=Dessiner les points d'intersection de la tangente avec les axes x/y|icon=Crystal Clear mimetype source c.png}}
 
<source lang="c">
/* ------------------------------------ */
Ligne 97 ⟶ 96 :
== Les fichiers h de ce chapitre ==
 
=== Appel des fichiers standards ===
 
{{Fichier|x_ahfile.h|largeur=70%|info=Appel des fichiers|icon=Crystal Clear mimetype source h.png}}
<source lang="c">
/* ------------------------------------ */
Ligne 119 :
=== La fonction à dessiner ===
 
{{Fichier|f2.h|largeur=70%|info=La fonction à dessiner|icon=Crystal Clear mimetype source h.png}}
<source lang="c">
/* ------------------------------------ */
Ligne 141 ⟶ 142 :
=== Equation de la tangente ===
 
{{Fichier|k_tan.h|largeur=70%|info=Equation de la tangente|icon=Crystal Clear mimetype source h.png}}
<source lang="c">
/* ------------------------------------ */
Ligne 182 ⟶ 184 :
=== La fonction graphique ===
 
{{Fichier|kg_tan.h|largeur=70%|info=La fonction graphique|icon=Crystal Clear mimetype source h.png}}
<source lang="c">
/* ------------------------------------ */
Ligne 194 ⟶ 197 :
)
{
FILE *fp = fopen("a_main.plt","w");
FILE *fq = fopen( "a_p.plt","w");
FILE *fr = fopen( "a_a.plt","w");
FILE *fs = fopen( "a_b.plt","w");
 
FILE * fp = fopen("a_outa_main.txtplt","w");
fprintf(fp,"# Gnuplot file : load \"a_main.plt\" \n\n"
" set zeroaxis \n"
Ligne 213 ⟶ 214 :
fclose(fp);
 
FILE *fqfp = fopen( "a_p.plt","w");
fprintf(fqfp," %0.6f %0.6f",
c, ((*P_f)(c)));
fclose(fqfp);
 
FILE *fr fp = fopen( "a_a.plt","w");
fprintf(frfp," %0.6f 0.",
c-((*P_f)(c))/((*PDf)(c)));
fclose(frfp);
 
FILE *fs fp = fopen( "a_b.plt","w");
fprintf(fsfp," 0. %0.6f",
((*P_f)(c))-(((*PDf)(c))*c));
fclose(fsfp);
}
</source>
 
 
==Un Exempleexemple avec sortiela fichierfonction ==sin.
 
* Dans cet exemple la sortie texte ce fait dans un fichier.
 
<source lang="c">
/* ------------------------------------ */
/* Save as : c01f.c */
/* ------------------------------------ */
#include "x_ahfile.h"
#include "f2.h"
/* ------------------------------------ */
int main(void)
{
FILE *fp = fopen("a_out.txt","w");
double c = 1;
 
fprintf(fp," f : x-> %s \n", feq);
fprintf(fp," Df : x-> %s\n\n",Dfeq);
 
fprintf(fp," With c = %0.3f, the equation of"
" the tangent is :\n\n"
" y = Df(c) (x-c) + f(c) = ",c);
eq_Tanf(fp,c,f,Df);
 
fprintf(fp," Find at c = %0.3f\n\n"
" the intersection points of the"
" tangent with the x-y axis.\n\n",c);
 
fprintf(fp," P(%5.3f, %5.3f) P(c, f(c))\n",
c, f(c));
 
fprintf(fp," A(%5.3f, 0.000) A(c-f(c)/Df(c), 0)\n",
c-(f(c))/(Df(c)));
 
fprintf(fp," B( 0, %5.3f) B(0, f(c)-c Df(c))\n",
f(c)-((Df(c))*c));
 
G_Tan_xy(i_WGnuplot(-7, 7,-2,2),
c,
feq,
f,Df);
 
fprintf(fp," load \"a_main.plt\" with gnuplot.");
fclose(fp);
 
printf(" Read \"a_out.txt\".\n"
" Press return to continue");
getchar();
 
return 0;
}
</source>
 
* Même exemple avec la fonction sin.
 
{| class="wikitable"