Mathc initiation/Fichiers h : c71a2


Sommaire

Installer ce fichier dans votre répertoire de travail.

kgtn_c.h
/* --------------------------------- */
/* save as  kgtn_c.h                 */
/* --------------------------------- */
void Gctn_2d(
CTRL_splot w,

double (*P_f)(double x),
double (*P_g)(double x),
double (*PDgDf)(double t),
tvalue t
)
{
double at =  (*PDgDf)(t.value);
double bt =(-(*PDgDf)(t.value)*(*P_f)(t.value)+(*P_g)(t.value));

double an = -1./  (*PDgDf)(t.value);
double bn = -1./(-(*PDgDf)(t.value))*(*P_f)(t.value)+(*P_g)(t.value);
       
FILE   *fp = fopen("a_main.plt","w");

 fprintf(fp," reset\n"
            " set size ratio -1\n"
            " set zeroaxis lt 8\n"
            " set grid\n"
            " plot [%0.3f:%0.3f] [%0.3f:%0.3f]\\\n"
            " \"a_curve\" with line lt 6 lw 3,\\\n"
            " %0.6f*x %+0.6f        lt 7 lw 3,\\\n"
            " %0.6f*x %+0.6f        lt 9 lw 3\n\n",
              w.xmin,w.xmax,w.ymin,w.ymax, 
              at,bt,
              an,bn );
 fclose(fp);

 fp = fopen("a_curve","w");

 for(t.value=t.min; t.value<=t.max; t.value+=t.step)
  fprintf(fp," %6.3f  %6.3f\n", (*P_f)(t.value),(*P_g)(t.value));
 fclose(fp);
}
/* --------------------------------- */
/* --------------------------------- */