Aller au contenu

Mathc matrices/c11bn

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                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RCA        RC5
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A         = rsymmetric_mR(i_mR(RCA,RCA),999.);

double **EigsVector=               i_mR(RCA,RCA);
double **T_EigsVector=             i_mR(RCA,RCA);

double **EigsValue =               i_mR(RCA,C1);
double **eigs_values=              i_mR(RCA,RCA);

double **T1=                       i_mR(RCA,RCA);

  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);
  stop();

  clrscrn();   
  
  eigs_V_mR(A,EigsVector); 
  transpose_mR(EigsVector,T_EigsVector);
  
  printf(" EigsVector:");
  p_mR(EigsVector,S10,P4,C6);
     
  mul_mR(T_EigsVector,A,T1);
  mul_mR(T1,EigsVector,eigs_values);
  
  printf(" EigsValue : T_EigsVector * A * EigsVector"); 
  p_mR(eigs_values,S10,P4,C6);  
   
  eigs_mR(A,EigsValue);
  
  printf(" EigsValue :");
  p_mR(EigsValue,S10,P4,C1);   
   
  f_mR(A);
  
  f_mR(EigsVector);
  f_mR(T_EigsVector);
  
  f_mR(EigsValue);  
  f_mR(eigs_values);
       
  f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
                       EValue = T_V * A * V

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

 a=[
-833,-347,-373,-301;
-347,+294,-87,+462;
-373,-87,-749,-41;
-301,+462,-41,-197]

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

 Press return to continue. 


 EigsVector:
   +0.7671    -0.2853    +0.3425    -0.4614 
   +0.1531    +0.8114    -0.3057    -0.4742 
   +0.5984    +0.0103    -0.5607    +0.5722 
   +0.1735    +0.5101    +0.6891    +0.4846 

 EigsValue : T_EigsVector * A * EigsVector
-1261.3064    +0.0000    -0.0000    +0.0000 
   +0.0000  +705.3783    +0.0000    +0.0000 
   -0.0000    +0.0000  -518.2077    -0.0000 
   +0.0000    -0.0000    -0.0000  -410.8641 

 EigsValue :
-1261.3064 
 +705.3783 
 -518.2077 
 -410.8641 


 Press return to continue
 Press X      to stop