Aller au contenu

Mathc complexes/012

Un livre de Wikilivres.

Application

Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A     = rlower_mZ(i_mZ(rc,rc),9);
double **invA  =           i_mZ(rc,rc);
double **AinvA =           i_mZ(rc,rc);

  clrscrn();

  printf(" A : ");
  p_mZ(A, S4,P0, S3,P0, C6);

  printf(" invA : ");
  p_mZ(inv_mZ(A,invA), S4,P3, S3,P3, C6);

  printf(" A * invA : ");
  p_mZ(mul_mZ(A,invA,AinvA), S4,P3, S3,P3, C6);
    
  f_mZ(A);
  f_mZ(invA);
  f_mZ(AinvA);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
   do 
         fun(rp_I(RC3)+RC1);
        
    while(stop_w());
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


L'inverse d'une matrice triangulaire inférieur


Exemple de sortie écran :

 A : 
  +5 -5i   +0 +0i   +0 +0i   +0 +0i 
  -3 -1i   -1 +5i   +0 +0i   +0 +0i 
  +4 -1i   -8 +2i   -7 -2i   +0 +0i 
  +4 -8i   -8 -3i   -7 +4i   +8 -5i 

 invA : 
+0.100+0.100i +0.000+0.000i +0.000+0.000i +0.000+0.000i 
+0.069-0.054i -0.038-0.192i +0.000+0.000i -0.000+0.000i 
+0.040+0.113i +0.147+0.167i -0.132+0.038i +0.000+0.000i 
-0.023+0.086i +0.237+0.014i -0.114+0.028i +0.090+0.056i 

 A * invA : 
+1.000+0.000i +0.000+0.000i +0.000+0.000i +0.000+0.000i 
+0.000-0.000i +1.000-0.000i +0.000+0.000i +0.000+0.000i 
-0.000+0.000i +0.000+0.000i +1.000-0.000i +0.000+0.000i 
+0.000+0.000i -0.000+0.000i -0.000+0.000i +1.000+0.000i 


 Press   return to continue
 Press X return to stop