Aller au contenu

Mathc matrices/a196

Un livre de Wikilivres.


Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RA R3
#define   CA C4
#define   Cb C1
/* ------------------------------------ */
int main(void)
{
double ab[RA*(CA+C1)]={
     3,   0,  -1,  -0,     0, //C
     8,   0,  -0,  -2,     0, //H
     0,   2,  -2,  -1,     0, //O      
};

double **Ab = ca_A_mR(ab,i_Abr_Ac_bc_mR(RA,CA,Cb));

double **Ab_free = i_Abr_Ac_bc_mR(csize_A_R(Ab),csize_A_R(Ab),Cb+C1);

double **b_free  = i_mR(rsize_R(Ab_free),csize_b_R(Ab_free)); 

int r;

  clrscrn();
  printf(" Ab :");
  p_mR(Ab,S10,P4,C10);

  printf(" Ab :  gj_PP_mR(Ab,NO) :");
  gj_PP_mR(Ab,NO);
  p_mR(Ab,S10,P4,C10);

  put_zeroR_mR(Ab,Ab_free);  
  printf(" Ab_free : put_zeroR_mR(Ab,Ab_free);");  
  p_mR(Ab_free,S10,P4,C10);  
  
  put_freeV_mR(Ab_free);
  printf(" Ab_free : put_freeV_mR(Ab_free);");  
  p_mR(Ab_free,S10,P4,C10);  
  stop();
  
  clrscrn();

  r = rsize_R(Ab_free);
  while(r>R1)    
        zero_below_pivot_gj1Ab_mR(Ab_free,r--);
        
  printf(" Ab_free : zero_below_pivot_gj1Ab_mR(Ab_free,r--);");  
  p_mR(Ab_free,S10,P4,C10);  

  c_Ab_b_mR(Ab_free,b_free);
  
  printf(" b_free : free variables");
  p_freeV(b_free,S8,P8);
  printf("Copy/Past These code in the next *.c file.\n\n");
  p_coefxn(b_free);
  stop();

  f_mR(Ab);
  f_mR(Ab_free);
  f_mR(b_free);
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
  • Nous résolvons le système.
  • Les valeurs permettant de calculer les coefficients de l'équation chimique sont données à la fin du programme.
  • Il faut copier la liste de ces valeurs dans le fichier suivant Calculer les coefficients..
Exemple de sortie écran :
 ---------------------
 Ab :
   +3.0000    +0.0000    -1.0000    +0.0000    +0.0000 
   +8.0000    +0.0000    +0.0000    -2.0000    +0.0000 
   +0.0000    +2.0000    -2.0000    -1.0000    +0.0000 

 Ab :  gj_PP_mR(Ab,NO) :
   +1.0000    +0.0000    +0.0000    -0.2500    +0.0000 
   +0.0000    +1.0000    -1.0000    -0.5000    +0.0000 
   -0.0000    -0.0000    +1.0000    -0.7500    -0.0000 

 Ab_free : put_zeroR_mR(Ab,Ab_free);
   +1.0000    +0.0000    +0.0000    -0.2500    +0.0000    +0.0000 
   +0.0000    +1.0000    -1.0000    -0.5000    +0.0000    +0.0000 
   -0.0000    -0.0000    +1.0000    -0.7500    -0.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +0.0000    +0.0000    +0.0000 

 Ab_free : put_freeV_mR(Ab_free);
   +1.0000    +0.0000    +0.0000    -0.2500    +0.0000    +0.0000 
   +0.0000    +1.0000    -1.0000    -0.5000    +0.0000    +0.0000 
   -0.0000    -0.0000    +1.0000    -0.7500    -0.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +1.0000    +0.0000    +1.0000 

 Press return to continue. 


 ---------------------
 Ab_free : zero_below_pivot_gj1Ab_mR(Ab_free,r--);
   +1.0000    +0.0000    +0.0000    +0.0000    +0.0000    +0.2500 
   +0.0000    +1.0000    +0.0000    +0.0000    +0.0000    +1.2500 
   +0.0000    +0.0000    +1.0000    +0.0000    +0.0000    +0.7500 
   +0.0000    +0.0000    +0.0000    +1.0000    +0.0000    +1.0000 

 b_free : free variables
 x1 =  +0.00000000 +0.25000000*u
 x2 =  +0.00000000 +1.25000000*u
 x3 =  +0.00000000 +0.75000000*u
 x4 =  +0.00000000 +1.00000000*u

Copy/Past These code in the next *.c file.

double x1 = +0.25000000;
double x2 = +1.25000000;
double x3 = +0.75000000;
double x4 = +1.00000000;


 Press return to continue.