Aller au contenu

Mathc initiation/a42

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.


kg_arc_l.h
/* ---------------------------------- */
/* save as kg_arc_l.h                 */
/* ---------------------------------- */
void   G_ArcLength(
double xmin,
double xmax,
double ymin,
double ymax,
double a,
double b,
double step,
  char feq[],
double (*P_f)(double x)
)
{
FILE   *fp;

        fp = fopen("a_main.plt","w");
fprintf(fp," set zeroaxis lt 8\n"
           " set grid\n\n"
           " plot [%0.3f:%0.3f] [%0.3f:%0.3f] "
           " %s,\\\n"
           " \"a_a\" with linesp lt 3 pt 1,\\\n"
           " \"a_b\" with linesp lt 3 pt 1,\\\n"
           " \"a_l\" with linesp lt 3 pt 1"
           " \n\n"
           " reset",
            xmin, xmax, ymin, ymax,
           feq);
 fclose(fp);

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

        fp = fopen("a_b",  "w");
fprintf(fp," %0.6f   %0.6f\n", b, (*P_f)(b));
fprintf(fp," %0.6f   %0.6f\n", b, 0.0);
 fclose(fp);

        fp = fopen("a_l",  "w");
do{
   fprintf(fp," %0.6f   %0.6f\n", a,(*P_f)(a));
   a += step;
}while(a <=  b);
 fclose(fp);
 
}
/* ---------------------------------- */
/* ---------------------------------- */