Aller au contenu

Mathc initiation/a91

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.


kg_grad.h
/* --------------------------------- */
/* save as kg_grad.h                 */
/* --------------------------------- */
void G_3d_levelcurvegradfxy(
CTRL_splot p,
  char feq[],
double (*P_f)(double x, double y),
double    h,
pt2d      Q
)
{
FILE   *fp;

        fp = fopen("a_main.plt","w");
        
fprintf(fp,"reset\n");

fprintf(fp,"set size ratio -1\n");

fprintf(fp,"set    samples 600\n");
fprintf(fp,"set isosamples 600\n");

fprintf(fp,"set xlabel \"X axis\"\n");
fprintf(fp,"set ylabel \"Y axis\"\n");
fprintf(fp,"set zlabel \"Z axis\" offset 1, 0\n");

fprintf(fp,"set view %0.3f, %0.3f, %0.3f, %0.3f \n",
                    p.rot_x,p.rot_z,p.scale,p.scale_z);

fprintf(fp,"set xrange [%0.3f:%0.3f]\n",p.xmin,p.xmax);
fprintf(fp,"set yrange [%0.3f:%0.3f]\n",p.ymin,p.ymax);
fprintf(fp,"set zrange [%0.3f:%0.3f]\n",((*P_f)(Q.x,Q.y)),
                                        ((*P_f)(Q.x,Q.y))+.1);
fprintf(fp,"splot ");
fprintf(fp,"%s ",feq);
fprintf(fp," ,\"a_vect\" with linesp lt 3\n");

 fclose(fp);

 fp = fopen("a_vect","w");
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", Q.x, Q.y, ((*P_f)(Q.x,Q.y)) );
         fprintf(fp," %6.3f   %6.3f   %6.3f\n", Q.x+fxy_x((*P_f),h,Q),
                                                Q.y+fxy_y((*P_f),h,Q),
                                                ((*P_f)(Q.x,Q.y)) );
 fclose(fp);
}
/* --------------------------------- */
/* --------------------------------- */


Dans ce fichier il y a les utilitaires.