Valeurs propres. Vecteurs propres

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


c00a.c
/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ 
 * Create the files a_main.plt *
 
# a_main.plt
 
reset
set zeroaxis lt 8
set grid
set view 90.,0.,  1., 1. 
splot [-20:20] [-20:20] [-20:20]\
"g_u1"  with linespoints lt 16 lw 3,\
"g_u2"  with linespoints lt 15 lw 3,\
"g_u3"  with linespoints lt 14 lw 3
reset
   ------------------------------------ */
#define   RCA RC3
#define   UC  20
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
double a[RCA*RCA]={
+75,+4,+8,
+4,+5,+2,
+8,+2,+7
};

double **A            = ca_A_mR(a,i_mR(RCA,RCA));
double **EigsVector   =           i_mR(RCA,RCA);
double **T_EigsVector =           i_mR(RCA,RCA);
double **EigsValue    =           i_mR(RCA,RCA);

double **T1           =           i_mR(RCA,RCA);
double **U            =      r_mR(i_mR(R3,UC),5);
double **AU           =           i_mR(R3,UC);

double **TR           =           i_mR(R1,RCA);

int i;

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n");
  p_Octave_mR(A,"a",P0);
  printf(" [V, E] = eigs (a,%d) \n\n",RCA);

  printf(" EignVector :             Octave Form with smul_c1_mR(-1;);");
  eigs_V_mR(A,EigsVector);
  smul_c1_mR(-1.,C1,EigsVector);
       p_mR(EigsVector,S14,P9,C5);
 
  printf(" EigsValue : T_EigsVector * A * EigsVector");   
  transpose_mR(EigsVector,T_EigsVector);   
        mul_mR(T_EigsVector,A,T1);
        mul_mR(T1,EigsVector,EigsValue);
          p_mR(EigsValue,S14,P9,C5);
  stop();

  clrscrn(); 
  printf(" EigsValue * EigsVector");   
  smul_c1_mR(EigsValue[R1][C1],C1,EigsVector);
  smul_c1_mR(EigsValue[R2][C2],C2,EigsVector); 
  smul_c1_mR(EigsValue[R3][C3],C3,EigsVector);             
        p_mR(EigsVector,S14,P9,C5); 

  printf("  A * U ");     
  mul_mR(A,U,AU);
  p_mR(AU,S6,P1,C5);
                     
  printf(" Create the files \"a_main.plt\", \"g_u1\", "
         "\"g_u2\", \"g_u3\"\n\n" 
          " ... load \"a_main.plt\" ... with gnuplot.   \n\n"
          "             See Below \n\n");  
  stop();

  clrscrn();
  printf(" Create the file\"g_u1\" \n\n"
         " g_u1 : EigsValue * EigsVector \n\n"); 
  for(i = C1; i <= RCA; i++)
   {
    printf("+0.0 +0.0 +0.0");   
    c_c_r_mR(EigsVector,i,TR,R1);
    p_mR(TR,S0,P9,C5);
    printf("\n");
   }  
  stop();

  clrscrn();
  printf(" Create the file\"g_u2\" \n\n"
         " g_u2 : U  \n\n"); 
  for(i = C1; i <= UC; i++)
   {
    printf("+0.0 +0.0 +0.0");   
    c_c_r_mR(U,i,TR,R1);
    p_mR(TR,S0,P1,C5);
    printf("\n");
   }  
  stop();
  
  clrscrn();
  printf(" Create the file\"g_u3\" \n\n"
         " g_u3 : AU = A * U \n\n"); 
  for(i = C1; i <= UC; i++)
   {
    printf("+0.0 +0.0 +0.0");   
    c_c_r_mR(AU,i,TR,R1);
    p_mR(TR,S0,P1,C5);
    printf("\n");
   }  
  stop();
         
  f_mR(A);
  f_mR(EigsVector); 
  f_mR(T_EigsVector);
  f_mR(EigsValue); 
  f_mR(T1);
  f_mR(U);
  f_mR(AU);
  f_mR(TR);
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Je vous propose de dessiner 20 vecteurs aléatoires multipliés par la matrice A. De comparer ce résultat avec les vecteurs propres multipliés par leurs valeurs propres.


Exemple de sortie écran :
 Copy/Past into the octave windows 

 a=[
+75,+4,+8;
+4,+5,+2;
+8,+2,+7]

 [V, E] = eigs (a,3) 

 EignVector :             Octave Form with smul_c1_mR(-1;);
  -0.991453599   -0.129595628   +0.014991154 
  -0.058987383   +0.547809280   +0.834521109 
  -0.116362580   +0.826504668   -0.550771989 

 EigsValue : T_EigsVector * A * EigsVector
 +76.176908505   +0.000000000   +0.000000000 
  +0.000000000   +7.071207751   -0.000000000 
  -0.000000000   -0.000000000   +3.751883745 

 Press return to continue. 


 EigsValue * EigsVector
 -75.525870084   -0.916397606   +0.056245066 
  -4.493476470   +3.873673224   +3.131026184 
  -8.864141617   +5.844386215   -2.066432471 

  A * U 
-336.0 -407.0 +182.0 -363.0  +87.0 
 -21.0  -20.0  +24.0  -29.0  -13.0 
 -65.0  -71.0  +41.0  -25.0  +26.0 

-237.0 +249.0 +304.0 +107.0  +47.0 
  -3.0  +10.0   -3.0  +28.0   -7.0 
 -39.0  +48.0  +43.0  +30.0  -15.0 

+379.0  +83.0 +122.0 +126.0 -162.0 
 +33.0  -10.0   +5.0   -6.0  -31.0 
 +39.0  +21.0  -10.0   -2.0  -19.0 

-260.0 +304.0  +91.0  +47.0  +43.0 
 +10.0   -3.0   +0.0   +9.0  -12.0 
  -3.0  +43.0  +25.0  -21.0  -17.0 

 Create the files "a_main.plt", "g_u1", "g_u2", "g_u3"

 ... load "a_main.plt" ... with gnuplot.   

             See Below