Aller au contenu

Mathc initiation/a202

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

kg_polaf.h
/* ------------------------------------ */
/*  Save as :   kg_polaf.h              */
/* ------------------------------------ */
void G_polar_areaf(
CTRL_splot w,
double (*P_r)(double k),
tvalue t,
double sector
)
{
FILE *fp = fopen("a_main.plt","w");

 fprintf(fp," reset\n"
            " set size ratio -1\n"
            " set polar\n" 
            " set grid polar lt 3\n\n"
            " plot [%0.3f:%0.3f] [%0.3f:%0.3f] [%0.3f:%0.3f]\\\n" 
            " \"curve\" with lines lt 7 lw 3,\\\n"
            " \"sector\" with lines lt 1 lw 3",
              t.min,t.max,    
              w.xmin,w.xmax,w.ymin,w.ymax);
 fclose(fp);


 fp = fopen("curve","w");
 for(t.value=t.min; t.value<t.max; t.value+=t.step)
     fprintf(fp," %6.3f   %6.3f\n",t.value,(*P_r)(t.value));
     
 fprintf(fp," %6.3f   %6.3f\n",t.max,(*P_r)(t.max));
 fclose(fp);

             
 fp = fopen("sector","w");
 fprintf(fp,"  %6.3f   %6.3f \n %6.3f   %6.3f \n",
            sector,(*P_r)(sector),0.,0.);
 fprintf(fp,"  %6.3f   %6.3f \n %6.3f   %6.3f \n",
            sector+2.*t.step,(*P_r)(sector+2.*t.step),0.,0.);
 fclose(fp);
}
/* ------------------------------------ */
/* ------------------------------------ */