Aller au contenu

Mathc matrices/01n

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 size ratio -1
set zeroaxis lt 8
set grid
plot [-7:7] [-7:7]\
"g_u1"  with linespoints lt 16 lw 3,\
"g_u2"  with linespoints lt 15 lw 3
reset

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

0.0 0.0   
-5.856966609 +3.049462239   
 ------------------------------------ 
# g_u2 

0.0 0.0   
+2.587651858 +4.969987933 

   ------------------------------------ */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RCA R2
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={
- 4, +5,
 +5, +3 
};

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);            
  p_mR(EigsVector,S14,P9,C6);
          
  printf(" Create the files \"a_main.plt\", \"g_u1\", \"g_u2\"\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:
  -4   +5 
  +5   +3 

 EignVector:
  +0.886978676   +0.461810381 
  -0.461810381   +0.886978676 

 EigsValue : T_EigsVector * A * EigsVector
  -6.603277808   +0.000000000 
  +0.000000000   +5.603277808 

 EigsValue * EigsVector
  -5.856966609   +2.587651858 
  +3.049462239   +4.969987933 

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

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

 Press return to continue.