Aller au contenu

Mathc matrices/01o

Un livre de Wikilivres.


Valeurs propres. Vecteurs propres

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


c00a.c
/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ 
 * Create the files a_main.plt, g_u1 and g_u2 
 * 
 
# a_main.plt
 
reset
set zeroaxis lt 8
set grid
set view 90.,0.,  1., 1. 
splot [-12:12] [-12:12] [-12:12]\
"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

 ------------------------------------ 
# g_u1

0.0 0.0 0.0   
+8.951477221 +5.720549605 +10.481573831   
 ------------------------------------ 
# g_u2 

0.0 0.0 0.0   
-0.162573802 +3.387826552 -1.71013956

 ------------------------------------  
# g_u3 

0.0 0.0 0.0   
-2.973991481 +0.893276815 +2.052323726 
   ------------------------------------ */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RCA C3
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={
+3,+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);

  clrscrn();
  printf(" A:");
  p_mR(A,S4,P0,C6);
   
  printf(" EignVector:");
  eigs_V_mR(A,EigsVector);  
  p_mR(EigsVector,S14,P9,C6);
  
  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,C6);

  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,C6);    
  printf(" Create the files \"a_main.plt\", \"g_u1\", "
         "\"g_u2\", \"g_u3\"\n\n" 
          " ... load \"a_main.plt\" ... with gnuplot.   \n\n");
  stop();
   
  f_mR(A);
  f_mR(EigsVector); 
  f_mR(T_EigsVector);
  f_mR(EigsValue); 
  f_mR(T1);
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Exemple de sortie écran :
 A:
  +3   +4   +8 
  +4   +5   +2 
  +8   +2   +7 

 EignVector:
  +0.599815943   -0.042799809   +0.798992497 
  +0.383319621   +0.891892346   -0.239987733 
  +0.702343863   -0.450217970   -0.551377255 

 EigsValue : T_EigsVector * A * EigsVector
 +14.923706718   +0.000000000   -0.000000000 
  +0.000000000   +3.798470263   -0.000000000 
  -0.000000000   -0.000000000   -3.722176980 

 EigsValue * EigsVector
  +8.951477221   -0.162573802   -2.973991481 
  +5.720549605   +3.387826552   +0.893276815 
 +10.481573831   -1.710139569   +2.052323726 

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

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

 Press return to continue.