« Mathc matrices/c29a0 » : différence entre les versions

Contenu supprimé Contenu ajouté
modification mineure
(Aucune différence)

Version du 17 novembre 2021 à 23:04


Sommaire


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


c00.c
/* ------------------------------------ */
/*  Save as :  c00.c               */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A         = rsymmetric_mR(i_mR(r,r),999.);
double **EigsVector=               i_mR(r,r);
double **EigsVector_T=             i_mR(r,r);
double **EigsValue =               i_mR(r,C1);


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

  eigs_V_uv_mR(A,EigsVector); 
  printf(" EigsVector:");
  p_mR(EigsVector, S5, P6, C6);
   
  eigs_value_uv_mR(A, EigsValue);
  printf(" EigsValue :");
  p_mR(EigsValue, S13, P6, C1);   
  stop();


  clrscrn(); 
  transpose_mR(EigsVector, EigsVector_T);
  printf(" Inverse of EigsVector = EigsVector_T\n");
  pE_mR(EigsVector_T, S12, P4, C6);
  
  printf(" Copy/Past into the octave windows \n\n");
  p_Octave_mR(EigsVector, "EigsVector", P6);
  printf(" format short e \n");
  printf(" inv(EigsVector) \n");
   
  f_mR(A);
  f_mR(EigsVector);
  f_mR(EigsVector_T);
  f_mR(EigsValue);
}
/* ------------------------------------ */
int main(void)
{

do
{
 fun(R3);

} while(stop_w());

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


Nous allons calculer la décomposition spectral de la matrice A. Nous aurons besoin des vecteurs propres et des valeurs propres de la matrice A, ainsi que de la matrice inverse de la matrice des vecteurs propres.


Notre matrice des vecteurs propres étant une matrice orthonormale, nous prendrons simplement sa transposé pour inverse.


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

 a=[
-479,-269,+992;
-269,-501,+904;
+992,+904,-763]

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

 EigsVector:
-0.512981 +0.544352 -0.663726 
-0.485715 +0.453457 +0.747300 
+0.707765 +0.705732 +0.031785 

 EigsValue :
 -2102.375181 
  +583.009012 
  -223.633832 

 Press return to continue. 




 Inverse of EigsVector = EigsVector_T

 -5.1298e-01  -4.8571e-01  +7.0777e-01 
 +5.4435e-01  +4.5346e-01  +7.0573e-01 
 -6.6373e-01  +7.4730e-01  +3.1785e-02 

 Copy/Past into the octave windows 

 EigsVector=[
-0.512981,+0.544352,-0.663726;
-0.485715,+0.453457,+0.747300;
+0.707765,+0.705732,+0.031785]

 format short e 
 inv(EigsVector) 

 Press return to continue
 Press X      to stop