Aller au contenu

Mathc complexes/01v

Un livre de Wikilivres.

Application

Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define FACTOR_E    +1.E-2         
#define RCA          RC3  
/* ------------------------------------ */
void fun(void)
{                          
double **A          = rdefinite_negative_mZ(  i_mZ(RCA,RCA),99);
double **invA       =              invgj_mZ(A,i_mZ(RCA,RCA));

double **V          =             eigs_V_mZ(A,i_mZ(RCA,RCA),FACTOR_E);;
double **invV       =                         i_mZ(RCA,RCA);
double **T          =                         i_mZ(RCA,RCA);

double **EigsValue  =                         i_mZ(RCA,RCA);
  
  clrscrn();
  printf(" A :"); 
  p_mZ(A, S10,P4, S8,P4, C3); 
  printf(" invA :"); 
  p_mZ(invA, S10,P4, S8,P4, C3); 
  stop();

  clrscrn(); 
  printf(" V :");
  eigs_V_mZ(A,V,FACTOR_E);
  pE_mZ(V, S12,P4, S12,P4, C3);
  printf(" inv(V)  :");
  invgj_mZ(V,invV);
  pE_mZ(invV, S12,P4, S12,P4, C3);
  stop();

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n\n");
  p_Octave_mZ(A,"a",P9,P9);  
  printf(" [V, E]  = eigs (a,%d) \n\n\n",RCA);
  
  printf(" EigsValue = invV * A * V");    
  mul_mZ(invV,A,T);
  mul_mZ(T,V,EigsValue); 
  p_mZ(EigsValue, S12,P4, S8,P4, C3); 
    
  f_mZ(A);
  f_mZ(invA);
  f_mZ(V);  
  f_mZ(invV);  
  f_mZ(T);  
  f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun();
    
} while(stop_w());

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


Ses valeurs propres sont négatives. Elle est inversible.


Exemple de sortie écran :

 A :
  -32.7761 -0.0000i    -4.9456 -6.4435i    -4.8983 +2.7897i 
   -4.9456 +6.4435i   -24.6874 -0.0000i   +10.2828 -3.1754i 
   -4.8983 -2.7897i   +10.2828 +3.1754i   -25.5365 -0.0000i 

 invA :
   -0.0368 -0.0000i    +0.0133 +0.0108i    +0.0138 -0.0013i 
   +0.0133 -0.0108i    -0.0576 -0.0000i    -0.0246 +0.0107i 
   +0.0138 +0.0013i    -0.0246 -0.0107i    -0.0532 +0.0000i 

 Press return to continue. 


 V :
 +6.0056e-02 -6.7168e-01i  +3.2511e-01 +5.4860e-01i  -3.7078e-01 -3.3146e-02i 
 -5.4761e-01 -1.3456e-01i  -1.9729e-01 +4.1046e-01i  +6.1681e-01 -3.0686e-01i 
 +4.7671e-01 +0.0000e+00i  +6.2124e-01 -1.0346e-16i  +6.2193e-01 +0.0000e+00i 

 inv(V)  :
 +6.0056e-02 +6.7168e-01i  -5.4761e-01 +1.3456e-01i  +4.7671e-01 -2.6645e-15i 
 +3.2511e-01 -5.4860e-01i  -1.9729e-01 -4.1046e-01i  +6.2124e-01 +3.3307e-15i 
 -3.7078e-01 +3.3146e-02i  +6.1681e-01 +3.0686e-01i  +6.2193e-01 -1.1657e-15i 

 Press return to continue. 


 Copy/Past into the octave windows 


 a=[
-32.776064241-0.000000000*i,-4.945595939-6.443463041*i,-4.898342079+2.789690639*i;
-4.945595939+6.443463041*i,-24.687435077-0.000000000*i,+10.282845855-3.175447140*i;
-4.898342079-2.789690639*i,+10.282845855+3.175447140*i,-25.536500682-0.000000000*i]

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


 EigsValue = invV * A * V
    -41.0000 -0.0000i      -0.0000 +0.0000i      -0.0000 +0.0000i 
     -0.0000 -0.0000i     -31.0000 -0.0000i      -0.0000 -0.0000i 
     +0.0000 +0.0000i      -0.0000 -0.0000i     -11.0000 +0.0000i 


 Press   return to continue
 Press X return to stop