Aller au contenu

Mathc initiation/Fichiers h : c72a2

Un livre de Wikilivres.


Sommaire


Installer et compiler ces fichiers dans votre répertoire de travail.

c0a2.c
/* --------------------------------- */
/* save as c0a2.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fa.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;
	
p.xmin = -10,   p.xmax    =  10;
p.ymin = -15,   p.ymax    =  10;
p.zmin = -15,   p.zmax    =  10;
p.rot_x = 60,   p.rot_z   = 135;
p.scale =  1,   p.scale_z =   1;

double   h = .0001;
pt2d     Q = i_pt2d(1.,2.);
v2d      u = grad_fxy(f,h,Q);
 
 clrscrn();
 printf(" Sketch both the level curve C of f that contains P and grad(P)\n\n\n");
 printf(" f : (x,y)-> %s\n\n\n", feq);
 printf(" with p(%+.3f,%+.3f) \n\n\n\n",Q.x,Q.y);

  printf(" In first sketch the graph of f(x,y) = 0\n\n\n");

     G_3d_eq(   p,
                feq,
                f,
                Q);

 printf("\n\n Open the file \"a_main.plt\" with gnuplot.\n");
 getchar();

 clrscrn();
  printf(" The grad(f)]p = %+.3fi  %+.3fj tells the direction of climb\n\n",
                                                u.i,u.j);
  printf(" at the point p(%+.3f,%+.3f)\n\n",    Q.x,Q.y);
  printf(" It is a vector normal to"
         " the level curves f(%+.3f,%+.3f) = %+.3f \n\n",
                                     Q.x,Q.y,f(Q.x,Q.y));
  printf(" The norm  gives the steepness ||grad(f)]p|| = %+.3f\n\n\n",     
                                  sqrt(u.i*u.i+u.j*u.j));

 p.xmin  = -10,   p.xmax    =  10;
 p.ymin  = -10,   p.ymax    =  10;
 p.zmin  = -10,   p.zmax    =  10;
 p.rot_x =0,      p.rot_z   = 119;
 p.scale =  1,    p.scale_z =   1;
  

  G_3d_levelcurvegradfxy(  p,
                           feq,f,
                           h,
                           Q);
 
 printf(" ... load \"a_main.plt\" ... with gnuplot.  \n\n");

 stop();

 return 0;
}
/* --------------------------------- */
/* --------------------------------- */



Exemple de sortie écran :

 Sketch both the level curve C of f that contains P and grad(P)


 f : (x,y)-> x**2 - 4*x*y


 with p(+1.000,+2.000) 



 In first sketch the graph of f(x,y) = 0




 Open the file "a_main.plt" with gnuplot.

Exemple de sortie écran :

 The grad(f)]p = -6.000i  -4.000j tells the direction of climb

 at the point p(+1.000,+2.000)

 It is a vector normal to the level curves f(+1.000,+2.000) = -7.000 

 The norm  gives the steepness ||grad(f)]p|| = +7.211


 Open the file "a_main.plt" with gnuplot.


 Press return to continue.