Mathc initiation/Fichiers h : c52a3
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c01b.c |
---|
/* --------------------------------- */
/* save as c01b.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fa.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;
p.xmin = 2, p.xmax = 6;
p.ymin = -6, p.ymax = -2;
p.zmin = -2, p.zmax = 2;
p.rot_x = 61, p.rot_z = 252;
p.scale = 1, p.scale_z = 1;
pt2d Q = i_pt2d( 4,-4);
int n = 5;
pt2d R = newton_fxy( n,
f_x,
f_y,
Q);
pt2d step = i_pt2d(.1,.1);
clrscrn();
printf(" Let f be a function of two variables \n\n");
printf(" that has continuous second partial derivatives\n");
printf(" throughout an open disk R containing (a,b). \n\n");
printf(" If f_x(a,b) = f_y(a,b) = 0 and \n\n");
printf(" Hessian(a,b) > 0 \n\n");
printf(" then f(a,b) is \n\n\n");
printf(" (I) a local maximum of f if f_xx(a,b) < 0\n\n");
printf(" (II) a local minimum of f if f_xx(a,b) > 0\n\n\n\n");
getchar();
clrscrn();
printf(" We have seen that we can take has first approximation,\n");
printf(" the point p(%.3f,%.3f) \n\n\n",Q.x,Q.y);
printf(" Use Newton's method to approximate,\n");
printf(" the solutions of the following system :\n\n");
printf(" Where the first equation is f_x, and the second f_y\n\n\n");
printf(" | %s = 0 \n", f_xeq);
printf(" | %s = 0\n\n\n", f_yeq);
printf(" the solutions of the following system is :\n\n\n");
printf(" x = %f y = %f \n\n\n",R.x,R.y);
getchar();
clrscrn();
printf(" Verify if f_x(a,b) = f_y(a,b) = 0.\n\n\n");
printf(" f : x,y-> %s\n\n\n", feq );
printf(" f_x(%0.2f,%0.2f) = %0.9f \n\n",R.x,R.y, fxy_x(f,H,R));
printf(" f_y(%0.2f,%0.2f) = %0.9f \n\n\n",R.x,R.y, fxy_y(f,H,R));
getchar();
clrscrn();
printf(" Verify if Hessian(a,b) > 0\n\n\n");
printf(" f : x,y-> %s\n\n\n", feq );
printf(" Hessian(%0.2f,%0.2f) = %0.9f \n\n",R.x,R.y,Hessian(f,f_xy,Q) );
getchar();
clrscrn();
printf(" if f_xx(a,b) < 0 then it is a local maximum.\n\n");
printf(" if f_xx(a,b) > 0 then it is a local minimum\n\n\n\n");
printf(" f : x,y-> %s\n\n\n", feq );
printf(" f_xx(%0.2f,%0.2f) = %0.9f\n\n\n\n",R.x,R.y, fxy_xx(f,H,R));
printf(" You can use f_yy instead of f_xx.\n\n");
printf(" f_yy(%0.2f,%0.2f) = %0.9f \n\n",R.x,R.y, fxy_yy(f,H,Q));
getchar();
clrscrn();
printf(" f : (x,y)-> %s\n\n\n", feq);
G_3d_pxy( p,
feq,f,
R,step);
printf(" ... load \"a_main.plt\" ... with gnuplot. \n\n");
stop();
return 0;
}
/* --------------------------------- */
/* --------------------------------- */
Exemple de sortie écran 1 :
Let f be a function of two variables
that has continuous second partial derivatives
throughout an open disk R containing (a,b).
If f_x(a,b) = f_y(a,b) = 0 and
Hessian(a,b) > 0p.
then f(a,b) is
(I) a local maximum of f if f_xx(a,b) < 0
(II) a local minimum of f if f_xx(a,b) > 0
Exemple de sortie écran 1 :
We have seen that we can take has first approximation,
the point p(4.000,-4.000)
Use Newton's method to approximate,
the solutions of the following system :
Where the first equation is f_x, and the second f_y
| -sin(x) = 0
| -sin(y) = 0
the solutions of the following system is :
x = 3.141593 y = -3.141593
Exemple de sortie écran 1 :
Verify if f_x(a,b) = f_y(a,b) = 0.
f : x,y-> cos(x)+cos(y)
f_x(3.14,-3.14) = 0.000000000
f_y(3.14,-3.14) = 0.000000000
Exemple de sortie écran 1 :
Verify if Hessian(a,b) > 0
f : x,y-> cos(x)+cos(y)
Hessian(3.14,-3.14) = 0.427249935
Exemple de sortie écran 1 :
if f_xx(a,b) < 0 then it is a local maximum.
if f_xx(a,b) > 0 then it is a local minimum
f : x,y-> cos(x)+cos(y)
f_xx(3.14,-3.14) = 0.999999994
You can use f_yy instead of f_xx.
f_yy(3.14,-3.14) = 0.653643584
Exemple de sortie écran 1 :
f : (x,y)-> cos(x)+cos(y)
Open the file "a_main.plt" with gnuplot.
Press return to continue.