Mathc initiation/Fichiers c : c24ca


Sommaire

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

Crystal Clear mimetype source c.png c16a.c
'
/* --------------------------------- */
/* save as c16a.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fa.h"
/* --------------------------------- */
int main(void)
{

double  a = .5;
double  b = .5;
pt2d    p = {a,b};
int     n = 4;
double  h = .1;

 clrscrn();
 p = i_pt2d(a,b); /* For info */
 printf(" Use Newton's method to approximate,        \n");
 printf(" the solutions of the following system :\n\n\n");

 printf("  | %s = 0    \n", feq);
 printf("  | %s = 0\n\n\n", geq);
 
 printf(" As a first approximation x = %.1f y = %.1f \n\n", a, b);
 
 stop();
 
  clrscrn();       
  p_newton_fxy(  n, f, g, h, p);   
  stop();        
   

  clrscrn();
  p = newton_fxy(  n, f, g, h, p); 
  printf(" the solutions of the following system is :\n\n\n");
  printf("         x = %f  y = %f  \n\n\n",p.x,p.y);

  printf(" f(%f,%f) = %f  \n",p.x,p.y, f(p.x, p.y));
  printf(" g(%f,%f) = %f\n\n",p.x,p.y, g(p.x,p.y) );
  stop();

 return 0;
}


Voir le fichier x_nwtn.h pour étudier l'algorithme.

Exemple de sortie écran :

 Use Newton's method to approximate,        
 the solutions of the following system :


  | x**2 + y**2 - 1 = 0    
  | y - sin(x) = 0


 As a first approximation x = 0.5 y = 0.5 

 Press return to continue.

Exemple de sortie écran :

 n = 1 
 f(0.500000,0.500000) = -0.500000  
 g(0.500000,0.500000) = +0.020574

 n = 2 
 f(0.777474,0.722526) = +0.126510  
 g(0.777474,0.722526) = +0.021045

 n = 3 
 f(0.740271,0.675011) = +0.003642  
 g(0.740271,0.675011) = +0.000523

 n = 4 
 f(0.739085,0.673614) = +0.000003  
 g(0.739085,0.673614) = +0.000002

 Press return to continue.

Exemple de sortie écran :

 the solutions of the following system is :


         x = 0.739085  y = 0.673614  


 f(0.739085,0.673614) = 0.000003  
 g(0.739085,0.673614) = 0.000002

 Press return to continue.