Mathc initiation/a36

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.


kg_fg_ab.h
/* ---------------------------------- */
/* save as kg_fg_ab.h                 */
/* ---------------------------------- */
void G_g_ab(
double xmin,
double xmax,
double ymin,
double ymax,
double a,
double b,
  char feq[],
  char geq[],
double (*P_f)(double x),
double (*P_g)(double x)
)
{
FILE   *fp;
char    FA[FILENAME_MAX] = "a_a";
char    FB[FILENAME_MAX] = "a_b";

        fp = fopen("a_main.plt","w");

fprintf(fp," set zeroaxis lt 8\n");
fprintf(fp," set grid\n\n");
fprintf(fp," plot [%0.3f:%0.3f] [%0.3f:%0.3f] ",xmin,xmax,ymin,ymax);
fprintf(fp,"%s,\\\n",feq);
fprintf(fp,"%s,\\\n",geq);
fprintf(fp," \"%s\" with linesp lt 7 pt 7,\\\n",FA);
fprintf(fp," \"%s\" with linesp lt 7 pt 7\n\n",FB);
fprintf(fp," reset");
             fclose(fp);

        fp = fopen(FA,  "w");
fprintf(fp," %0.6f   %0.6f\n", a, ((*P_f)(a)));
fprintf(fp," %0.6f   %0.6f\n", a, ((*P_g)(a)));
             fclose(fp);

        fp = fopen(FB,  "w");
fprintf(fp," %0.6f   %0.6f\n", b, ((*P_f)(b)) );
fprintf(fp," %0.6f   %0.6f\n", b, ((*P_g)(b)));
             fclose(fp);
}
/* ---------------------------------- */
/* ---------------------------------- */


Déclaration des fichiers h.