< Mathc matrices


Sommaire


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


inv_r_a.c
'
/* ------------------------------------ */
/*  Save as :   inv_r_a.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
int main(void)
{
double a[R4*C5]={
    +964,     -689,     +474,     +948, 
    +640,     -693,     -937,     +6568, 
    -981,     -337,     -287,     +420, 
    -807,     -123,     +404,     -177 
};

double **A   = ca_A_mR(a,i_mR(R4,C4));
double **Inv =           i_mR(R4,C4);

  clrscrn();
  printf(" A :");
  p_mR(A,8,0,7);
  stop();

  clrscrn();
  printf(" invgj_mR(A,invA); gauss jordan (AId)\n");
  pE_mR(invgj_mR(A,Inv),12,4,6);
  printf(" inv_mR(A,Inv);  det,...,adjoint,... \n");
  pE_mR(inv_mR(A,Inv),12,4,6);
  stop();

  clrscrn();
  printf(" Copy/Past into the octave window.\n\n");
  p_octave_mR(A,"A",1,0);
  printf(" inv(A)\n");
  pE_mR(Inv,12,4,6);
  stop();
  
  f_mR(Inv);
  f_mR(A);  
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Déclaration des fichiers h.



Exemple de sortie écran :
 ------------------------------------ 
 A :
    +964     -689     +474     +948 
    +640     -693     -937    +6568 
    -981     -337     -287     +420 
    -807     -123     +404     -177 

 Press return to continue. 


 ------------------------------------ 
 invgj_mR(A,invA); gauss jordan (AId)

 +2.7996e-04  -3.9752e-05  -2.6770e-04  -6.1084e-04 
 -1.1087e-03  +2.8397e-04  -1.5880e-03  +8.3126e-04 
 +1.6906e-04  +9.4485e-05  -1.1522e-03  +1.6775e-03 
 -1.2014e-04  +1.9957e-04  -3.0584e-04  +3.8655e-04 

 inv_mR(A,Inv);  det,...,adjoint,... 

 +2.7996e-04  -3.9752e-05  -2.6770e-04  -6.1084e-04 
 -1.1087e-03  +2.8397e-04  -1.5880e-03  +8.3126e-04 
 +1.6906e-04  +9.4485e-05  -1.1522e-03  +1.6775e-03 
 -1.2014e-04  +1.9957e-04  -3.0584e-04  +3.8655e-04 

 Press return to continue. 


 ------------------------------------ 
 Copy/Past into the octave window.

 A=[
+964,-689,+474,+948;
+640,-693,-937,+6568;
-981,-337,-287,+420;
-807,-123,+404,-177]

 inv(A)

 +2.7996e-04  -3.9752e-05  -2.6770e-04  -6.1084e-04 
 -1.1087e-03  +2.8397e-04  -1.5880e-03  +8.3126e-04 
 +1.6906e-04  +9.4485e-05  -1.1522e-03  +1.6775e-03 
 -1.2014e-04  +1.9957e-04  -3.0584e-04  +3.8655e-04 

 Press return to continue.
Cet article est issu de Wikibooks. Le texte est sous licence Creative Commons - Attribution - Partage dans les Mêmes. Des conditions supplémentaires peuvent s'appliquer aux fichiers multimédias.