Mathc initiation/Fichiers h : c22a2


Sommaire


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

c0d2.c
/* --------------------------------- */
/* save as c0d2.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include   "kg_3d.h"
#include "kg_grad.h"
#include      "fd.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;
	
p.xmin = -4,   p.xmax    =  4;
p.ymin = -4,   p.ymax    =  4;
p.zmin = -1,   p.zmax    =  1;
p.rot_x = 60,   p.rot_z   = 88;
p.scale =  1,   p.scale_z =   1;

double   h = .0001;
pt2d     Q = i_pt2d(2.2,-0.5);
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  = -4,   p.xmax    =  4;
 p.ymin  = -4,   p.ymax    =  4;
 p.zmin  = -5,   p.zmax    =  10;
 p.rot_x =0,      p.rot_z   = 93;
 p.scale =  1,    p.scale_z =   1;
  

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

 stop();

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


grad f(x,y)]p = Le gradient au point p. 

Exemple de sortie écran :

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


 f : (x,y)-> cos(x*y)


 with p(+2.200,-0.500) 



 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 = -0.446i  +1.961j tells the direction of climb

 at the point p(+2.200,-0.500)

 It is a vector normal to the level curves f(+2.200,-0.500) = +0.454 

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


 Open the file "a_main.plt" with gnuplot.
 Press return to continue.