Aller au contenu

Mathc initiation/Fichiers h : c49a2

Un livre de Wikilivres.


Sommaire


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

c0c2.c
/* --------------------------------- */
/* save as c0c2.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fc.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;
	
p.xmin  =  -4,   p.xmax    =   4;
p.ymin  =  -4,   p.ymax    =   4;
p.zmin  =   2,   p.zmax    =  25;
p.rot_x =  66,   p.rot_z   = 225;
p.scale =   1,   p.scale_z =   1;

double   h = .0001;
pt2d     Q = i_pt2d(-2.,1.);
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(" ... load \"a_main.plt\" ... with gnuplot.  \n\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  = -15,   p.xmax    =   5;
 p.ymin  =  -0,   p.ymax    =  20;
 p.zmin  = -10,   p.zmax    =  10;
 p.rot_x =   0,   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)-> 2*x**2-3*x*y+8*y**2+2*x-4*y+4


 with p(-2.000,+1.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 = -9.000i  +18.000j tells the direction of climb

 at the point p(-2.000,+1.000)

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

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


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