Aller au contenu

Mathc complexes/a9a

Un livre de Wikilivres.


Applications

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

c00f.c
/* ------------------------------------ */
/*  Save as:  c00f.c                    */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E  +1.E-1    
#define ARRAY     A3
/* ------------------------------------ */
#define RC        RC3
/* ------------------------------------ */
void fun(void)
{
double **A         = rcsymmetric_mZ(        i_mZ(RC,RC),99);
double **AEVect    =      eigs_V_mZ(A,      i_mZ(RC,RC),FACTOR_E);
double **InvAEVect =  ctranspose_mZ(AEVect, i_mZ(RC,RC));
double **AEValue   =        eigs_mZ(A,      i_mZ(RC,C1)); 

double **T         =                        i_mZ(RC,RC);
double **a         =                        i_mZ(RC,RC);

double **b    [ARRAY];
double **r    [ARRAY];
double **br   [ARRAY];
double **EVabr[ARRAY];

int i;

  for(i=A0; i<ARRAY; i++)
     {
      b[i]     =  c_c_mZ(   AEVect,i+C1,                i_mZ(RC,C1),C1);
      r[i]     =  c_r_mZ(InvAEVect,i+R1,                i_mZ(R1,RC),R1);
      
      br[i]    =  mul_mZ(b[i],r[i],                     i_mZ(RC,RC));
       
      EVabr[i] = smul_mZ(AEValue[i+R1][C1]*AEValue[i+R1][C1],br[i], 
                                                        i_mZ(RC,RC));               
      }
      
  clrscrn();
  printf(" A:");
  p_mZ(A, S7,P0,S6,P0,C7);

  printf(" eigenvectors of A");
  p_mZ(AEVect, S5,P4,S5,P4,C7);
  
  printf(" eigenvalues of A");
  p_mZ(AEValue, S8,P0,S4,P0,C7);
  stop();

  clrscrn(); 
  printf(" A**2:");
  pow_mZ(2, A, T);
  p_mZ(T, S12,P0,S11,P0,C7);
  
  add_mZ(EVabr[0], EVabr[1], T); 
  add_mZ(       T, EVabr[2], a);  
  printf(" We can calculate the nth power of A\n"
         " by simply taking the nth power of  \n"
         " each of the eigenvalues.     \n\n\n\n"
         " E1**2 b1r1 + E2**2 b2r2 + E3**2 b3r3 = A**2");
  p_mZ(a, S12,P0,S11,P0,C7);
   
  f_mZ(A);
  f_mZ(AEVect);
  f_mZ(InvAEVect);
  f_mZ(AEValue); 
  
  f_mZ(T);
  f_mZ(a);
  
  for(i=A0; i<ARRAY; i++)
     {
       f_mZ(    b[i]);
       f_mZ(    r[i]);
       f_mZ(   br[i]);
       f_mZ(EVabr[i]);                    
     } 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
 fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Nous voyons une des propriétés de la décomposition spectral:

* E1**2 * b1r1 + E2**2 * b2r2 + E3**2 * b3r3 = A**2
* E1**n * b1r1 + E2**n * b2r2 + E3**n * b3r3 = A**n

On peux calculer la nième puissance de A en simplement prenant la puissance nième de chacune des valeurs propres.

Exemple de sortie écran :
 A:
 +16708    +0i    -770-12048i   +7087 +1534i 
   -770+12048i  +17282    +0i   +3872 +6416i 
  +7087 -1534i   +3872 -6416i  +12317    +0i 

 eigenvectors of A
+0.6268-0.0884i -0.1875+0.4438i -0.2380-0.5573i 
+0.1361+0.6356i +0.3436-0.3172i -0.5958-0.0615i 
+0.4204+0.0000i +0.7411+0.0000i +0.5235+0.0000i 

 eigenvalues of A
  +33513  -0i 
  +10492  +0i 
   +2302  -0i 

 Press return to continue. 


 A**2:
  +477483193         +0i    +11110708 -449042064i   +280018703   -7065826i 
   +11110708 +449042064i   +500572168         +0i    +90668706 +274110180i 
  +280018703   +7065826i    +90668706 -274110180i   +260444654         +0i 

 We can calculate the nth power of A
 by simply taking the nth power of  
 each of the eigenvalues.     



 E1**2 b1r1 + E2**2 b2r2 + E3**2 b3r3 = A**2
  +477483193         +0i    +11110708 -449042064i   +280018703   -7065826i 
   +11110708 +449042064i   +500572168         +0i    +90668706 +274110180i 
  +280018703   +7065826i    +90668706 -274110180i   +260444654         +0i 


 Press   return to continue
 Press X return to stop