Aller au contenu

Mathc initiation/000e

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

kg_fgab.h
/* --------------------------------- */
/* save as  kg_fgab.h                */
/* --------------------------------- */
void G_fgab_2d(
CTRL_splot w,

tvalue     ft,
double    (*P_f)(double x),
char       feq[],

tvalue     gt,
double    (*P_g)(double x),
char       geq[]
)
{
FILE *fp = fopen("a_main.plt","w");

double i;

fprintf(fp," reset\n"
           " set zeroaxis lt 8\n"
           " set grid\n\n"
           " set size ratio -1\n"
           " plot [%0.3f:%0.3f] [%0.3f:%0.3f]\\\n"
           "    x    with line   lt 0 lw 1,\\\n"
           "   -x    with line   lt 0 lw 1,\\\n"
           " \"%s\"  with line   lt 7 lw 1,\\\n"
           " \"%s\"  with line   lt 8 lw 1\n\n",
             w.xmin,w.xmax,w.ymin,w.ymax,
             feq,geq);
  fclose(fp);
              
  i = ft.min;              
  fp = fopen(feq,  "w");
  do{ 
	  fprintf(fp," %0.6f   %0.6f\n", i,(*P_f)(i));
      i += ft.step;
    }while(i <= ft.max);
 fclose(fp);
 
  i = gt.min;              
  fp = fopen(geq,  "w");
  do{ 
	  fprintf(fp," %0.6f   %0.6f\n", i,(*P_g)(i));
      i += gt.step;
    }while(i <= gt.max);
 fclose(fp);
}
/* --------------------------------- */
/* --------------------------------- */