Aller au contenu

Mathc complexes/08t

Un livre de Wikilivres.


Application

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

c00b.c
/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */    
#define RCA           RC5  
/* ------------------------------------ */       
/* ------------------------------------ */
int main(void)
{                          
double a[RCA*RCA] ={   
+0.329527604306, -0.365886364507, -0.067047239569, +0.001915635416, -0.287345312440, 
-0.365886364507, +0.800330583940, -0.036588636451, +0.001045389613, -0.156808441932, 
-0.067047239569, -0.036588636451, +0.993295276043, +0.000191563542, -0.028734531244, 
+0.001915635416, +0.001045389613, +0.000191563542, +0.999994526756, +0.000820986607, 
-0.287345312440, -0.156808441932, -0.028734531244, +0.000820986607, +0.876852008954                   
};

double v[RCA*RCA] ={
-0.479027840775, -0.099503719020, +0.002857131195, -0.393919298579, +0.818823787938,
+0.877799708227, +0.000000000000, +0.000000000000, +0.000000000000, +0.446843838561, 
+0.000000000000, +0.995037190210, +0.000000000000, +0.000000000000, +0.081882378794, 
+0.000000000000, +0.000000000000, +0.999995918392, +0.000000000000, -0.002339496537,
+0.000000000000, +0.000000000000, +0.000000000000, +0.919145030018, +0.350924480545
};     
                       
double **A      =  ca_A_mRZ(a, i_mZ(RCA,RCA));
double **V      =  ca_A_mRZ(v, i_mZ(RCA,RCA));
double **invV   =  invgj_mZ(V, i_mZ(RCA,RCA));
double **EValue =              i_mZ(RCA,RCA);

double **T      =              i_mZ(RCA,RCA);

  clrscrn(); 
  printf(" A :");
  p_mRZ(A, S8,P6, C5);     

  printf(" V :");
  p_mRZ(V, S9,P6, C5); 
 
  printf(" EValue = invV * A * V");
  mul_mZ(invV,A,T);
  mul_mZ(T,V,EValue);
  p_mRZ(EValue, S9,P6, C5); 
  stop();
  
  clrscrn();
  printf(" A :");
  p_mRZ(A, S8,P6, C5);
             
  printf(" A = V * EValue * invV        (Just verify the computation)");
  mul_mZ(V,EValue,T);
  mul_mZ(T,invV,A); 
  p_mRZ(A, S8,P6, C5);
  stop();
  
  clrscrn();
  printf(" V1        V2        V3        V4        V5 ");
  p_mRZ(V, S9,P6, C5); 
   
  printf(" EValue1   EValue2   EValue3   EValue4   EValue5 ");
  p_mRZ(EValue, S9,P6, C5); 

  printf(" det(V)  = ");p_Z(det_Z(V), S4,P0, S5,P0);printf("\n");   
  printf(" det(V) != 0.00 V1,V2,V3,V4 and V5 are linearly independent\n\n"); 
  stop();
  
  clrscrn();                    
  printf(" The matrix A projects the space in  the direction\n"
         " of the  eigenvector V5  on a hyperplan determined\n"
         " by the eigenvector V1,V2,V3 and V4 if :\n\n"
         " The eigenvector V1 has its eigenvalue equal to  one and   \n"
         " The eigenvector V2 has its eigenvalue equal to  one and   \n"
         " The eigenvector V3 has its eigenvalue equal to  one and   \n"
         " The eigenvector V4 has its eigenvalue equal to  one and   \n"
         " The eigenvector V5 has its eigenvalue equal to zero and \n\n"
         " If The vectors V1,V2,V3,V4 and V5 are linearly independent\n\n");                            
  stop();
  
  f_mZ(A);
  f_mZ(V);  
  f_mZ(invV);  
  f_mZ(T);  
  f_mZ(EValue);

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Dans cet exemple nous pouvons voir que nous n'utilisons que des matrices réelles. Les fonctions *_mRZ travail directement sur des valeurs réelles. ex : ca_A_mRZ(); qui copie un tableau de réelles dans une matrice complexes. p_mRZ(); qui affiche uniquement les valeurs réelles.  

Exemple de sortie écran :

 A :
+0.329528 -0.365886 -0.067047 +0.001916 -0.287345 
-0.365886 +0.800331 -0.036589 +0.001045 -0.156808 
-0.067047 -0.036589 +0.993295 +0.000192 -0.028735 
+0.001916 +0.001045 +0.000192 +0.999995 +0.000821 
-0.287345 -0.156808 -0.028735 +0.000821 +0.876852 

 V :
-0.479028 -0.099504 +0.002857 -0.393919 +0.818824 
+0.877800 +0.000000 +0.000000 +0.000000 +0.446844 
+0.000000 +0.995037 +0.000000 +0.000000 +0.081882 
+0.000000 +0.000000 +0.999996 +0.000000 -0.002339 
+0.000000 +0.000000 +0.000000 +0.919145 +0.350924 

 EValue = invV * A * V
+1.000000 -0.000000 +0.000000 -0.000000 +0.000000 
-0.000000 +1.000000 +0.000000 -0.000000 +0.000000 
+0.000000 +0.000000 +1.000000 +0.000000 -0.000000 
-0.000000 -0.000000 +0.000000 +1.000000 -0.000000 
-0.000000 -0.000000 +0.000000 -0.000000 -0.000000 

 Press return to continue. 


 A :
+0.329528 -0.365886 -0.067047 +0.001916 -0.287345 
-0.365886 +0.800331 -0.036589 +0.001045 -0.156808 
-0.067047 -0.036589 +0.993295 +0.000192 -0.028735 
+0.001916 +0.001045 +0.000192 +0.999995 +0.000821 
-0.287345 -0.156808 -0.028735 +0.000821 +0.876852 

 A = V * EValue * invV        (Just verify the computation)
+0.329528 -0.365886 -0.067047 +0.001916 -0.287345 
-0.365886 +0.800331 -0.036589 +0.001045 -0.156808 
-0.067047 -0.036589 +0.993295 +0.000192 -0.028735 
+0.001916 +0.001045 +0.000192 +0.999995 +0.000821 
-0.287345 -0.156808 -0.028735 +0.000821 +0.876852 

 Press return to continue. 


 V1        V2        V3        V4        V5 
-0.479028 -0.099504 +0.002857 -0.393919 +0.818824 
+0.877800 +0.000000 +0.000000 +0.000000 +0.446844 
+0.000000 +0.995037 +0.000000 +0.000000 +0.081882 
+0.000000 +0.000000 +0.999996 +0.000000 -0.002339 
+0.000000 +0.000000 +0.000000 +0.919145 +0.350924 

 EValue1   EValue2   EValue3   EValue4   EValue5 
+1.000000 -0.000000 +0.000000 -0.000000 +0.000000 
-0.000000 +1.000000 +0.000000 -0.000000 +0.000000 
+0.000000 +0.000000 +1.000000 +0.000000 -0.000000 
-0.000000 -0.000000 +0.000000 +1.000000 -0.000000 
-0.000000 -0.000000 +0.000000 -0.000000 -0.000000 

 det(V)  =   +1   +0i 
 det(V) != 0.00 V1,V2,V3,V4 and V5 are linearly independent

 Press return to continue. 


 The matrix A projects the space in  the direction
 of the  eigenvector V5  on a hyperplan determined
 by the eigenvector V1,V2,V3 and V4 if :

 The eigenvector V1 has its eigenvalue equal to  one and   
 The eigenvector V2 has its eigenvalue equal to  one and   
 The eigenvector V3 has its eigenvalue equal to  one and   
 The eigenvector V4 has its eigenvalue equal to  one and   
 The eigenvector V5 has its eigenvalue equal to zero and 

 If The vectors V1,V2,V3,V4 and V5 are linearly independent

 Press return to continue.