Mathc initiation/Fichiers h : c65a3
Installer et compiler ces fichiers dans votre répertoire de travail.
c00b.c |
---|
/* --------------------------------- */
/* save as c00b.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fa.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;
p.xmin = 4, p.xmax = 8;
p.ymin = -8, p.ymax = -4;
p.zmin = -2, p.zmax = 2;
p.rot_x = 59, p.rot_z = 247;
p.scale = 1, p.scale_z = 1;
pt2d Q = i_pt2d(5.5,-5.5);
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,R) );
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,Q.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,R));
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(5.500,-5.500)
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 = 6.283185 y = -6.283185
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(6.28,-6.28) = 0.000000000
f_y(6.28,-6.28) = 0.000000000
Exemple de sortie écran 1 :
Verify if D(a,b) > 0
f : x,y-> cos(x)+cos(y)
Hessian(6.28,-6.28) = 0.999999988
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(6.28,-5.50) = -0.999999994
You can use f_yy instead of f_xx.
f_yy(6.28,-6.28) = -0.999999994
Exemple de sortie écran 1 :
f : (x,y)-> cos(x)+cos(y)
Open the file "a_main.plt" with gnuplot.
Press return to continue.