Décomposition d'une matrice en éléments propres

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


c00c.c
/* ------------------------------------ */
/*  save as :   c00c.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E        +1.E-0   
/* ------------------------------------ */
/* ------------------------------------ */
double f(
double x)
{  
        return(sinh(2*x));
}
char  feq[] = "sinh(2*x)";
/* ------------------------------------ */
double g(
double x)
{  
        return(2*sinh(x)*cosh(x));
}
char  geq[] = "2*sinh(x)*cosh(x)";
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int rc)
{
double **A           = rEcsymmetric_mZ(            i_mZ(rc,rc),99,1E-2);
double **A_T         =   ctranspose_mZ(A,          i_mZ(rc,rc));

double **U           =         X_U_mZ(A_T,        i_mZ(rc,rc),FACTOR_E);
double **U_T         =  ctranspose_mZ(U,          i_mZ(rc,rc));

double **U_TA        =          mul_mZ(U_T, A,            i_mZ(rc,rc));
double **X           =          mul_mZ(U_TA, U,           i_mZ(rc,rc));
            
double **sinh2X       =      f_eigs_mZ(f,X,               i_mZ(rc,rc));
double **Usinh2X      =         mul_mZ(U,sinh2X,          i_mZ(rc,rc));
double **sinh2        =         mul_mZ(Usinh2X,U_T,       i_mZ(rc,rc));

double **twocoshsinhX  =     f_eigs_mZ(g,X,               i_mZ(rc,rc));
double **UtwocoshsinhX =        mul_mZ(U,twocoshsinhX,    i_mZ(rc,rc));
double **twocoshsinh   =        mul_mZ(UtwocoshsinhX,U_T, i_mZ(rc,rc));

  clrscrn();
  printf(" A :");
  pE_mZ(A, S12,P3, S11,P3, C3);
     
  printf(" U :");
  pE_mZ(U, S12,P3, S11,P3, C3);
     
  printf(" X = U_T * A * U :");
  p_mZ(X, S12,P6, S11,P6, C3);;
  stop(); 

  clrscrn();
  printf(" sinh(2*A)");
  pE_mZ(sinh2, S12,P3, S11,P3, C3); 
  printf(" 2*sinh(A)*cosh(A)");
  pE_mZ(twocoshsinh, S12,P3, S11,P3, C3);      
     
   f_mZ(A);
   f_mZ(A_T);

   f_mZ(U);
   f_mZ(U_T);
   f_mZ(U_TA);
   f_mZ(X);

   f_mZ(sinh2X);
   f_mZ(Usinh2X);
   f_mZ(sinh2);

   f_mZ(twocoshsinhX);
   f_mZ(UtwocoshsinhX);
   f_mZ(twocoshsinh);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun(R3);
    
} while(stop_w());

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


Exemple de sortie écran :
 A :
  +2.698e+00 +0.000e+00i   -3.860e-02 +3.012e-01i   +8.917e-01 +7.318e-01i 
  -3.860e-02 -3.012e-01i   +1.106e+00 +0.000e+00i   +1.052e+00 +3.390e-01i 
  +8.917e-01 -7.318e-01i   +1.052e+00 -3.390e-01i   +1.630e+00 +0.000e+00i 

 U :
  +5.296e-01 +5.393e-01i   -2.880e-01 -5.126e-01i   -2.635e-01 -1.163e-01i 
  +2.966e-01 +6.867e-03i   +5.266e-01 +4.037e-01i   -6.245e-01 -2.859e-01i 
  +5.836e-01 -4.050e-18i   +4.627e-01 +0.000e+00i   +6.673e-01 +0.000e+00i 

 X = U_T * A * U :
   +3.654677  -0.000000i    +0.000000  +0.000000i    +0.000000  -0.000000i 
   +0.000000  -0.000000i    +1.757993  +0.000000i    +0.000000  +0.000000i 
   +0.000000  +0.000000i    +0.000000  -0.000000i    +0.020830  +0.000000i 

 Press return to continue. 


 sinh(2*A)
  +4.327e+02 +2.842e-14i   +1.141e+02 +1.142e+02i   +2.287e+02 +2.312e+02i 
  +1.141e+02 -1.142e+02i   +7.319e+01 +0.000e+00i   +1.334e+02 +6.126e+00i 
  +2.287e+02 -2.312e+02i   +1.334e+02 -6.126e+00i   +2.581e+02 +0.000e+00i 

 2*sinh(A)*cosh(A)
  +4.327e+02 +2.842e-14i   +1.141e+02 +1.142e+02i   +2.287e+02 +2.312e+02i 
  +1.141e+02 -1.142e+02i   +7.319e+01 +0.000e+00i   +1.334e+02 +6.126e+00i 
  +2.287e+02 -2.312e+02i   +1.334e+02 -6.126e+00i   +2.581e+02 +0.000e+00i 


 Press   return to continue
 Press X return to stop