Aller au contenu

Mathc complexes/01x

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 r)
{
double **A      =  rdefinite_positive_mZ(       i_mZ(r,r), 99);
double **invA   =                 inv_mZ(A,     i_mZ(r,r));
double **EValue =                 eigs_mZ(invA, i_mZ(r,C1));

  clrscrn();  
  printf(" A = Q D QT: ");
  p_mZ(A, S8,P4, S8,P4, C4);
  
  printf(" invA  ");
  p_mZ(invA, S8,P4, S8,P4, C4);
  
  printf(" InvA : EValue are positives");
  p_mZ(EValue, S8,P4, S8,P4, C4);   
  
  f_mZ(A);
  f_mZ(invA);
  f_mZ(EValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(R3)+R1);

} while(stop_w());

  return 0;
}

/* ------------------------------------ */
/* ------------------------------------ */


La matrice inverse d'une matrice définie positive est définie positive.


Exemple de sortie écran :

 A = Q D QT: 
+39.2160 +0.0000i -15.1179 +2.2833i  +4.3458-10.8737i -11.1258 -1.9791i 
-15.1179 -2.2833i +46.0757 +0.0000i  +0.9251 -3.0236i  -2.2333 -0.0293i 
 +4.3458+10.8737i  +0.9251 +3.0236i +36.9974 +0.0000i  +8.7226+16.7301i 
-11.1258 +1.9791i  -2.2333 +0.0293i  +8.7226-16.7301i +42.7109 +0.0000i 

 invA  
 +0.0516 -0.0000i  +0.0206 -0.0022i  -0.0140 +0.0296i  +0.0290 +0.0017i 
 +0.0206 +0.0022i  +0.0303 -0.0000i  -0.0079 +0.0142i  +0.0140 +0.0017i 
 -0.0140 -0.0296i  -0.0079 -0.0142i  +0.0561 -0.0000i  -0.0141 -0.0311i 
 +0.0290 -0.0017i  +0.0140 -0.0017i  -0.0141 +0.0311i  +0.0469 -0.0000i 

 InvA : EValue are positives
 +0.1250 -0.0000i 
 +0.0263 -0.0000i 
 +0.0172 +0.0000i 
 +0.0164 +0.0000i 


 Press   return to continue
 Press X return to stop