Aller au contenu

Mathc initiation/Fichiers h : c74a2

Un livre de Wikilivres.


Sommaire


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

c0b2.c
/* --------------------------------- */
/* save as c0b2.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fb.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;

p.xmin  =   -6.,   p.xmax    =   6;
p.ymin  =   -6.,   p.ymax    =   6;
p.zmin  =   -1.,   p.zmax    =  10;
p.rot_x =   84.,   p.rot_z   = 244;
p.scale =    1.,   p.scale_z =   1;

double   h = .0001;
pt2d     Q = i_pt2d(-4,3);
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  =   -5,  p.xmax    =  -1;
 p.ymin  =   1.,  p.ymax    =   5;
 p.zmin  = -10.,  p.zmax    =  10;
 p.rot_x =   3.,  p.rot_z   = 180;
 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;
}
/* --------------------------------- */
/* --------------------------------- */


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)-> sqrt(x**2 + y**2)


 with p(-4.000,+3.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 = -0.800i  +0.600j tells the direction of climb

 at the point p(-4.000,+3.000)

 It is a vector normal to the level curves f(-4.000,+3.000) = +5.000 

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


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