« Mathc gnuplot/Tableau de pointeurs de fonctions » : différence entre les versions

Contenu supprimé Contenu ajouté
m Formatage, ajout de code
DannyS712 (discussion | contributions)
m <source> -> <syntaxhighlight> (phab:T237267)
Ligne 25 :
==== Déclaration du tableau ====
 
<sourcesyntaxhighlight lang="c">
double (*TrigF[6])(double x) = {cos,sin,tan,atan,asin,acos};
</syntaxhighlight>
</source>
 
* Toutes les fonctions ont la même forme : <code>double ''fonction''(double)</code>.
Ligne 36 :
==== Exemple d'un appel ====
 
<sourcesyntaxhighlight lang="c">
cos(.5) == TrigF[0](.5)
</syntaxhighlight>
</source>
 
 
Ligne 44 :
 
{{Fichier|c01.c|largeur=70%|info=Exemple à tester|icon=Crystal Clear mimetype source c.png}}
<sourcesyntaxhighlight lang="c">
/* ------------------------------ */
/* Save as c01.c */
Ligne 71 :
return 0;
}
</syntaxhighlight>
</source>
 
 
Ligne 84 :
 
{{Fichier|c02.c|largeur=70%|info=Avec le résultat dans un fichier|icon=Crystal Clear mimetype source c.png}}
<sourcesyntaxhighlight lang="c">
/* ------------------------------ */
/* Save as c02.c */
Ligne 117 :
return 0;
}
</syntaxhighlight>
</source>
 
 
Ligne 157 :
 
{{Fichier|c03.c|largeur=70%|info=Avec le résultat à l'écran|icon=Crystal Clear mimetype source c.png}}
<sourcesyntaxhighlight lang="c">
/* ------------------------------ */
/* Save as c03.c */
Ligne 182 :
return 0;
}
</syntaxhighlight>
</source>
 
 
Ligne 194 :
==== Déclaration du tableau ====
 
<sourcesyntaxhighlight lang="c">
double (*Derivate[3])(double (*P_f)(double x),double a,double h) = {fx,Df_x,Df_xx};
</syntaxhighlight>
</source>
 
* Toutes les fonctions (fx,Df_x,Df_xx) ont la même forme : <code>double ''fonction''(double (*P_f)(double x) double double)</code>.
Ligne 210 :
 
 
<sourcesyntaxhighlight lang="c">
f(x) == Derivate[0](f,x,0.)
</syntaxhighlight>
</source>
 
 
Ligne 223 :
 
{{Fichier|c04.c|largeur=70%|info=Exemple à tester|icon=Crystal Clear mimetype source c.png}}
<sourcesyntaxhighlight lang="c">
/* ------------------------------ */
/* Save as c04.c */
Ligne 302 :
return 0;
}
</syntaxhighlight>
</source>