Aller au contenu

Mathc initiation/Fichiers h : c50a3

Un livre de Wikilivres.


Sommaire


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

c02b.c
/* --------------------------------- */
/* save as c02b.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include     "fa.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot p;
	
p.xmin  =    1,   p.xmax    =    5;
p.ymin  =   -8,   p.ymax    =   -4;
p.zmin  = -1.5,   p.zmax    =  1.5;
p.rot_x =   90,   p.rot_z   =  360;
p.scale =    1,   p.scale_z =    1;

pt2d Q = i_pt2d( 3.5,-6.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) );
  printf(" Then p(%0.3f,%0.3f,%0.3f) is a saddle point on the graph of f\n\n\n",
            R.x,R.y,f(R.x,R.y));
 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) > 0.                        

 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(3.500,-6.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 = 3.141593  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(3.14,-6.28) = 0.000000000    

 f_y(3.14,-6.28) = 0.000000000


Exemple de sortie écran 1 :

 Verify if Hessian(a,b) < 0


 f   : x,y-> cos(x)+cos(y)


 Hessian(3.14,-6.28) = -0.999999988    

 Then p(3.142,-6.283,0.000) is a saddle point on the graph of f


Exemple de sortie écran 1 :

 f : (x,y)-> cos(x)+cos(y)


 Open the file "a_main.plt" with gnuplot.

 Press return to continue.