Mathc initiation/Fichiers h : c76a2
Installer et compiler ces fichiers dans votre répertoire de travail.
c0e2.c |
---|
/* --------------------------------- */
/* save as c0e2.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fe.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;
p.xmin = -8, p.xmax = 8;
p.ymin = -8, p.ymax = 8;
p.zmin = -2, p.zmax = 2;
p.rot_x = 33, p.rot_z = 136;
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 = -2, p.xmax = 3;
p.ymin = -1, p.ymax = 4;
p.zmin = -5, p.zmax = 10;
p.rot_x = 358, p.rot_z = 59;
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)-> cos(x)+sin(y)
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 = -0.909i +0.540j 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) = +0.425
The norm gives the steepness ||grad(f)]p|| = +1.058
Open the file "a_main.plt" with gnuplot.
Press return to continue.