« Mathc gnuplot/Application : Champ de tangentes » : différence entre les versions
Contenu supprimé Contenu ajouté
m Xhungab a déplacé la page Mathc gnuplot/Application : Champ de tangente vers Mathc gnuplot/Application : Champ de tangentes : mis aux pluriels |
Aucun résumé des modifications |
||
Ligne 58 :
{{Fichier|
<source lang="c">
/* ------------------------------------ */
Ligne 94 :
|-
| [[File:Tangente39.svg|Tangente01]]
|}
=== Dessiner un champ de normales 3 ===
{{Fichier|c03.c|largeur=70%|info=Dessiner un champ de normales 3|icon=Crystal Clear mimetype source c.png}}
<source lang="c">
/* ------------------------------------ */
/* Save as : c03.c */
/* ------------------------------------ */
#include "x_ahfile.h"
#include "f3.h"
/* ------------------------------------ */
int main(void)
{
printf(" f : x-> %s \n", feq);
printf(" f': x-> %s\n\n",Dfeq);
printf(" The equation of the tangent is : \n\n");
printf(" y = f'(c) (x-c) + f(c) \n\n");
G_NorA(i_WGnuplot(-2,2,-1,2.4),
i_time(-2,2,.05),
feq,
f,
Df);
printf(" load \"a_main.plt\" with gnuplot. \n\n"
" Press return to continue");
getchar();
return 0;
}
</source>
{| class="wikitable"
|-
! Résultat dans gnuplot
|-
| [[File:Tangente40.svg|Tangente01]]
|}
=== Dessiner un champ de normales 4 ===
{{Fichier|c04.c|largeur=70%|info=Dessiner un champ de normales 4|icon=Crystal Clear mimetype source c.png}}
<source lang="c">
/* ------------------------------------ */
/* Save as : c04.c */
/* ------------------------------------ */
#include "x_ahfile.h"
#include "f1.h"
/* ------------------------------------ */
int main(void)
{
printf(" f : x-> %s \n", feq);
printf(" f': x-> %s\n\n",Dfeq);
printf(" The equation of the tangent is : \n\n");
printf(" y = f'(c) (x-c) + f(c) \n\n");
G_NorA(i_WGnuplot(-2, 2,-1.7,1.7),
i_time(-2.,2.,.05),
feq,
f,
Df);
printf(" load \"a_main.plt\" with gnuplot. \n\n"
" Press return to continue");
getchar();
return 0;
}
</source>
{| class="wikitable"
|-
! Résultat dans gnuplot
|-
| [[File:Tangente41.svg|Tangente01]]
|}
Ligne 160 ⟶ 243 :
{{Fichier|
<source lang="c">
/* ------------------------------------ */
/* Save as :
/* ----------- f ----------------------
double f(
double x)
{
return( x*x);
}
char feq[] = " x**2";
/* ------------ f' --------------------- */
double Df(
double x)
{
return( 2*x );
}
char Dfeq[] = " 2*x ";
</source>
{{Fichier|kg_tan.h|largeur=70%|info=Les fonctions graphiques|icon=Crystal Clear mimetype source h.png}}
<source lang="c">
/* ------------------------------------ */
/* Save as : kg_tan.h */
/* ------------------------------------ */
void G_TanA(
W_Ctrl w,
Ligne 202 ⟶ 294 :
fprintf(fp," %0.6f*x %+0.6f\n",
(*PDf)(p), (-(*PDf)(p)*p+(*P_f)(p)) );
fprintf(fp," reset");
fclose(fp);
}
/* ------------------------------------ */
void G_NorA(
W_Ctrl w,
t_Ctrl Pic,
char fEQ[],
double (*P_f)(double x),
double (*PDf)(double x)
)
{
FILE *fp = fopen("a_main.plt","w");
double p = Pic.mini;
fprintf(fp,"# Gnuplot file : load \"a_main.plt\"\n"
" set size ratio -1\n"
" set zeroaxis\n\n"
" unset key\n\n"
" plot [%0.3f:%0.3f] [%0.3f:%0.3f] \\\n"
" %s, \\\n",
w.xmini,w.xmaxi,w.ymini,w.ymaxi,
fEQ);
for(;p<Pic.maxi;p+=Pic.step)
fprintf(fp," %0.6f*x %+0.6f, \\\n",
(-1/(*PDf)(p)), (1/(*PDf)(p)*p+(*P_f)(p)) );
fprintf(fp," %0.6f*x %+0.6f\n",
(-1/(*PDf)(p)), (1/(*PDf)(p)*p+(*P_f)(p)) );
fprintf(fp," reset");
|