Aller au contenu

Mathc complexes/04j

Un livre de Wikilivres.

Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define FACTOR_E    +1.E-3
#define RCA          RC3 
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{
double a[RCA*(RCA*C2)] ={   
 +799,   +0,  +211,   +0,  +972,   +0, 
 -791,   +0,  -775,   +0,  +886,   +0, 
 +258,   +0,  -748,   +0,  +845,   +0
};
 
double v[RCA*(RCA*C2)] ={  
/*	 This is the copy of V1 and V2 of the last files
            V1              V2  ... */	 
-0.392876479763,-0.184665385219, -0.392876479763,+0.184665385219, +0.843497900770,+0.000000000000,
+0.543372780837,-0.551826033775, +0.543372780837,+0.551826033775, -0.091769245452,+0.000000000000,
+0.460196497862,-0.000000000000, +0.460196497862,+0.000000000000, +0.529235011111,+0.000000000000
};    
  
double eigsvalue[RCA*(RCA*C2)] ={
 -258.452490846828,+793.405003240218,                 0,                0, 0,                  0,
                 0,                0, -258.452490846828,-793.405003240218, 0,                  0,
                 0,                0,                 0,                0, +1385.904981693673,+0
};
                       
double **A         =  ca_A_mZ(a,        i_mZ(RCA,RCA));
double **V         =  ca_A_mZ(v,        i_mZ(RCA,RCA));
double **invV      = invgj_mZ(V,        i_mZ(RCA,RCA));
double **T         =                    i_mZ(RCA,RCA);
double **EigsValue = ca_A_mZ(eigsvalue, i_mZ(RCA,RCA));

  clrscrn();
  printf(" A :");
  p_mZ(A, S8,P4, S6,P4, C4);

  printf(" V :");
  p_mZ(V, S8,P4, S6,P4, C4); 
  printf(" invV :");
  p_mZ(invV, S8,P4, S6,P4, C4);
  stop();

  clrscrn();   
  printf(" EigsValue : invV * A * V");
  mul_mZ(invV,A,T);
  mul_mZ(T,V,EigsValue); 
    p_mZ(clean_eyes_mZ(EigsValue), S8,P2, S6,P2, C4);
 
  printf(" A :");
  p_mZ(A, S8,P4, S6,P4, C4); 
  
  printf(" A = V * EigsValue * invV");
  mul_mZ(V,EigsValue,T);
  mul_mZ(T,invV,A); 
    p_mZ(A, S8,P4, S6,P4, C4); 
  stop();
          
  f_mZ(A);
  f_mZ(V);  
  f_mZ(invV);  
  f_mZ(T);  
  f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
  fun();

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


Vérifions les calculs précédents.


Exemple de sortie écran : Trouvons les valeurs complexes
 A :
+799.0000+0.0000i +211.0000+0.0000i +972.0000+0.0000i 
-791.0000+0.0000i -775.0000+0.0000i +886.0000+0.0000i 
+258.0000+0.0000i -748.0000+0.0000i +845.0000+0.0000i 

 V :
 -0.3929-0.1847i  -0.3929+0.1847i  +0.8435+0.0000i 
 +0.5434-0.5518i  +0.5434+0.5518i  -0.0918+0.0000i 
 +0.4602-0.0000i  +0.4602+0.0000i  +0.5292+0.0000i 

 invV :
 -0.3746+0.4230i  +0.1253+0.7645i  +0.6187-0.5416i 
 -0.3746-0.4230i  +0.1253-0.7645i  +0.6187+0.5416i 
 +0.6514-0.0000i  -0.2180+0.0000i  +0.8135-0.0000i 

 Press return to continue. 


 EigsValue : invV * A * V
 -258.45+793.41i    +0.00 +0.00i    +0.00 +0.00i 
   +0.00 +0.00i  -258.45-793.41i    +0.00 +0.00i 
   +0.00 +0.00i    +0.00 +0.00i +1385.90 -0.00i 

 A :
+799.0000+0.0000i +211.0000+0.0000i +972.0000+0.0000i 
-791.0000+0.0000i -775.0000+0.0000i +886.0000+0.0000i 
+258.0000+0.0000i -748.0000+0.0000i +845.0000+0.0000i 

 A = V * EigsValue * invV
+799.0000-0.0000i +211.0000+0.0000i +972.0000-0.0000i 
-791.0000-0.0000i -775.0000+0.0000i +886.0000-0.0000i 
+258.0000-0.0000i -748.0000+0.0000i +845.0000-0.0000i 

 Press return to continue.