Aller au contenu

Mathc matrices/c11dn

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        RC3
/* ------------------------------------ */
/* ------------------------------------ */
double f(
double x)
{
        return(1.0/(x));
}
char  feq[] =  "1.0/(x)";
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A             = rsymmetric_mR(i_mR(RCA,RCA),999.);
double **invA          =               i_mR(RCA,RCA);

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

double **EigsValue     =               i_mR(RCA,RCA);
double **invEigsValue  =               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("format short e\n");
  printf(" inv (a) \n\n");

  eigs_V_mR(A,EigsVector); 
  transpose_mR(EigsVector,T_EigsVector); 
    
/* EigsValue : T_EigsVector * A * EigsVector */  
  mul_mR(T_EigsVector,A,T1);
  mul_mR(T1,EigsVector,EigsValue);   
    
  f_eigs_mR(f,EigsValue,invEigsValue);

//A == EigsVector * EigsValue * T_EigsVector  
  mul_mR(EigsVector,invEigsValue,T1);
  mul_mR(T1,T_EigsVector,invA);
  
  printf(" invA : EigsVector * invEigsValue * T_EigsVector");  
  pE_mR(invA,S10,P4,C6); 
  
  printf(" Ide = A * invA "); 
  p_mR(mul_mR(A,invA,T1),S10,P5,C10);     
   
  f_mR(A);
  f_mR(invA);
    
  f_mR(EigsVector);
  f_mR(T_EigsVector);
  
  f_mR(EigsValue);
  f_mR(invEigsValue);    
     
  f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

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


                        invA = V * invEValue * T_V


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

 a=[
+754,+802,-773;
+802,-445,-911;
-773,-911,-779]

format short e
 inv (a) 

 invA : EigsVector * invEigsValue * T_EigsVector
-3.1542e-04 +8.6740e-04 -7.0139e-04 
+8.6740e-04 -7.7337e-04 +4.3696e-05 
-7.0139e-04 +4.3696e-05 -6.3881e-04 

 Ide = A * invA 
  +1.00000   -0.00000   +0.00000 
  +0.00000   +1.00000   +0.00000 
  -0.00000   +0.00000   +1.00000 


 Press return to continue
 Press X      to stop