Aller au contenu

Mathc matrices/a253

Un livre de Wikilivres.


Application


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


inv_r.c
/* ------------------------------------ */
/*  Save as :   inv_r.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A   = r_mR(i_mR(r,r),9999.);
double **Inv =      i_mR(r,r);
double **ID  =      i_mR(r,r);

  clrscrn();
  printf(" Copy/Past into the octave window.\n\n");
  p_Octave_mR(A,"A",P0);
  printf(" inv(A)\n");
  pE_mR(inv_mR(A,Inv),S12,P4,C4);
  stop();
  
  clrscrn();
  printf(" inv(A)*A\n");  
  p_mR(mul_mR(Inv,A,ID),S0,P4,C8);
  printf(" A*inv(A)\n");  
  p_mR(mul_mR(A,Inv,ID),S0,P4,C8);

  f_mR(ID);
  f_mR(Inv);
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(rp_I(RC4)+C1);

} while(stop_w());


  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Vérifier avec octave.



Exemple de sortie écran :
 Copy/Past into the octave window.

 A=[
-4532,-7887,+3757,-9980,-1633;
-5915,+8415,+3925,+2667,-3612;
+8971,+6896,+9892,+1557,-7736;
+976,+4251,-3176,+7797,+7083;
+1996,+8007,-7833,-5417,-6939]

 inv(A)

 +1.2847e-05  -7.7703e-05  +5.7116e-05  +4.6001e-05 
 +1.0627e-04  +3.7942e-05  +4.6980e-05  +1.5877e-04 
 +8.3529e-05  +2.4906e-05  +5.7843e-05  +6.6634e-05 
 -1.8780e-04  +1.8080e-05  -4.8339e-05  -1.6178e-04 
 +1.7864e-04  -2.0799e-05  +4.3082e-05  +2.4752e-04 

 +2.0704e-05 
 +6.4934e-05 
 -2.9092e-05 
 -7.6465e-05 
 +2.9303e-05 

 Press return to continue. 


 inv(A)*A

+1.0000 -0.0000 -0.0000 -0.0000 +0.0000 
+0.0000 +1.0000 -0.0000 +0.0000 -0.0000 
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 
-0.0000 -0.0000 +0.0000 +1.0000 +0.0000 
+0.0000 +0.0000 -0.0000 +0.0000 +1.0000 

 A*inv(A)

+1.0000 -0.0000 -0.0000 -0.0000 +0.0000 
+0.0000 +1.0000 -0.0000 +0.0000 -0.0000 
+0.0000 +0.0000 +1.0000 +0.0000 +0.0000 
-0.0000 -0.0000 +0.0000 +1.0000 +0.0000 
+0.0000 +0.0000 -0.0000 +0.0000 +1.0000 


 Press return to continue
 Press X      to stop