Aller au contenu

Mathc initiation/0005

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

kg_f0ab9.h
/* --------------------------------- */
/* save as  kg_f0ab9.h               */
/* --------------------------------- */
void G_f0ab9p_2d(
CTRL_splot                w,
double     (*P_f)(double x),
tvalue                    p
)
{
FILE *fp = fopen("a_main.plt","w");

double i = p.min;

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"
           " \"a\"    with linesp lt 7 lw 3 pt 1,\\\n"
           " \"b\"    with linesp lt 7 lw 3 pt 1,\\\n"
           " \"fab\"  with line   lt 8 lw 3,\\\n"
           " \"f0a\"  with line   lt 0 lw 3,\\\n"
           " \"fb9\"  with line   lt 0 lw 3,\\\n"
           " \"p\"    with linesp lt 6 lw 5 ps 3\n\n",
             w.xmin,w.xmax,w.ymin,w.ymax);
  fclose(fp);


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


  fp = fopen("b",  "w");
     fprintf(fp," %0.6f   %0.6f\n", p.max, (*P_f)(p.max));
     fprintf(fp," %0.6f   %0.6f\n", p.max, 0.0);
      fclose(fp);
      
  i  = p.min;                   
  fp = fopen("fab",  "w");
  do{ 
	  fprintf(fp," %0.6f   %0.6f\n", i,(*P_f)(i));
      i += p.step;
    }while(i <= p.max + p.step);
  fclose(fp);


  i  = w.xmin;          
  fp = fopen("f0a",  "w");
  do{ 
	  fprintf(fp," %0.6f   %0.6f\n", i,(*P_f)(i));
      i += p.step;
    }while(i <= p.min + p.step);
  fclose(fp);
  

  i  = p.max;          
  fp = fopen("fb9",  "w");
  do{ 
	  fprintf(fp," %0.6f   %0.6f\n", i,(*P_f)(i));
      i += p.step;
    }while(i <= w.xmax + p.step);
  fclose(fp);
  
              
  fp = fopen("p","w");
  fprintf(fp,"  %6.5f  %6.5f  \n\n", p.min, (*P_f)(p.min));
  fprintf(fp,"  %6.5f  %6.5f    \n", p.max, (*P_f)(p.max));
   fclose(fp);   
}
/* --------------------------------- */
/* --------------------------------- */