Aller au contenu

Mathc initiation/Fichiers h : c17bb

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

kgt_c.h
/* --------------------------------- */
/* save as kgt_c.h                   */
/* --------------------------------- */
void G_Tanxy(
CTRL_splot w,
double (*P_f)  (double t),
double (*P_g)  (double t),
double (*PDgDf)(double t),
tvalue t
)
{
double a =  (*PDgDf)(t.value);
double b =(-(*PDgDf)(t.value)*(*P_f)(t.value)+(*P_g)(t.value));

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

 fprintf(fp," set zeroaxis lt 8 lw 2 \n"
            " set size ratio -1\n"
            " plot [%0.3f:%0.3f] [%0.3f:%0.3f]\\\n"
            " \"a_pts\" with line lt 6 lw 3,\\\n"
            " %0.6f*x %+0.6f      lt 7 lw 3,\\\n"
            " \"a_P\" lt  6 lw 8,\\\n" 
            " \"axP\" lt  8 lw 5,\\\n" 
            " \"ayP\" lt  8 lw 5\n",
            w.xmin,w.xmax,w.ymin,w.ymax,
            a,b);
 fclose(fp);
             
 fp = fopen("a_P","w");
      fprintf(fp," %0.6f   %0.6f",(*P_f)(t.value), (*P_g)(t.value)  );
 fclose(fp);
             
 fp = fopen("axP","w");
 fprintf(fp," %0.6f  0.", 
            ((*P_f)(t.value))-((*P_g)(t.value))/((*PDgDf)(t.value)));
 fclose(fp);
                          
 fp = fopen("ayP","w");
 fprintf(fp," 0.   %0.6f",
            ((*P_g)(t.value))-(((*PDgDf)(t.value))*((*P_f)(t.value))));
 fclose(fp);
             
 fp = fopen("a_pts","w");
 for(t.value=t.min; t.value<=t.max; t.value+=t.step)
     fprintf(fp," %6.6f   %6.6f\n",(*P_f)(t.value),(*P_g)(t.value));
 fclose(fp);
}
/* --------------------------------- */
/* --------------------------------- */