Aller au contenu

Mathc complexes/02n

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-1
         
#define RCA          RC4 
#define EV           RC1  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*(RCA*C2)] ={   
+1.329842932,+0.000000000, -0.125654450,-0.209424084, -0.041884817,-0.376963351, -0.041884817,+0.125654450, 
-0.125654450,+0.209424084, +1.910994764,+0.000000000, -0.125654450,-0.057591623, +0.031413613,+0.036649215, 
-0.041884817,+0.376963351, -0.125654450,+0.057591623, +1.785340314,+0.000000000, +0.068062827,+0.031413613, 
-0.041884817,-0.125654450, +0.031413613,-0.036649215, +0.068062827,-0.031413613, +1.973821990,+0.000000000  
};
             
double **A        = ca_A_mZ(a,           i_mZ(RCA,RCA));
double **sA       = smul_mZ(FACTOR_E, A, i_mZ(RCA,RCA));
double **EValue   = eigs_mZ(         sA, i_mZ(RCA,RCA));
double **V        =                      i_mZ(RCA,RCA);

double **Ide      =  eye_mZ(             i_mZ(RCA,RCA));
double **zIde     =                      i_mZ(RCA,RCA);
double **sAmnszIde =                     i_mZ(RCA,RCA);

double **Ab       =            i_Abr_Ac_bc_mZ(RCA,RCA,C1);
double **b        =                      i_mZ(    RCA,C1);
double **Ab_free  =            i_Abr_Ac_bc_mZ(RCA,RCA,C4);
double  **b_free  =                      i_mZ(    RCA,C4);

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n");
  p_Octave_mZ(A,"a",P9,P9);  
  printf(" format short e\n"
         " [V, E]  = eigs (a,%d)\n\n", RCA); 
  stop();

         zmul_mZ(i_Z(EValue[EV][C1],EValue[EV][C2]),Ide,zIde);           
          sub_mZ(sA,zIde,sAmnszIde);
      
     c_A_b_Ab_mZ(sAmnszIde,b,Ab); 

  GJ_PP_FreeV_mZ(Ab,Ab_free,b_free);
    
          c_c_mZ(b_free,C2,V,EV); 
          c_c_mZ(b_free,C3,V,EV+C1); 
          c_c_mZ(b_free,C4,V,EV+C2); 
                    
    Normalize_mZ(V);

  clrscrn();  
  printf("     zIde : EV%d * Ide",EV);                 p_mZ(zIde, S9,P5, S8,P5, C4);  

  printf(" sAmnszIde : A - (EV%d*Ide)",EV);            p_mZ(sAmnszIde, S9,P5, S8,P5, C4); 
  stop();

  clrscrn();  
  printf("                 A        x  = b \n"
         "       Ab : [A-(EV%d*Ide)] V%d = 0 ",EV,EV); p_mZ(Ab, S9,P5, S8,P5, C4);  

  printf("  Ab_free : [A-(EV%d*Ide)] V%d = 0 ",EV,EV); p_mZ(Ab_free, S9,P5, S8,P5, C4);  
  stop();

  clrscrn();  
  printf("   b_free :");                               p_mZ(b_free, S9,P5, S8,P5, C4); 
        
  printf("      V%d : Copy V%d into the next file",EV,EV);  P_mZ(V, S9,P9, S8,P9, C4); 
      
  stop();
              
  f_mZ(A);
  f_mZ(V);  
  f_mZ(EValue);
  
  f_mZ(Ide);

  f_mZ(sAmnszIde);
       
  f_mZ(sA);
  
  f_mZ(Ab);
  f_mZ(b);
  
  f_mZ(Ab_free);
  f_mZ(b_free);  
}
/* ------------------------------------ */
int main(void)
{
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Calculer les vecteurs propres des trois valeurs propres identiques


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

 a=[
+1.329842932+0.000000000*i,-0.125654450-0.209424084*i,-0.041884817-0.376963351*i,-0.041884817+0.125654450*i;
-0.125654450+0.209424084*i,+1.910994764+0.000000000*i,-0.125654450-0.057591623*i,+0.031413613+0.036649215*i;
-0.041884817+0.376963351*i,-0.125654450+0.057591623*i,+1.785340314+0.000000000*i,+0.068062827+0.031413613*i;
-0.041884817-0.125654450*i,+0.031413613-0.036649215*i,+0.068062827-0.031413613*i,+1.973821990+0.000000000*i]

 format short e
 [V, E]  = eigs (a,4)

 Press return to continue. 


     zIde : EV1 * Ide
 +0.20000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.20000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.20000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +0.20000+0.00000i 

 sAmnszIde : A - (EV1*Ide)
 -0.06702-0.00000i  -0.01257-0.02094i  -0.00419-0.03770i  -0.00419+0.01257i 
 -0.01257+0.02094i  -0.00890-0.00000i  -0.01257-0.00576i  +0.00314+0.00366i 
 -0.00419+0.03770i  -0.01257+0.00576i  -0.02147-0.00000i  +0.00681+0.00314i 
 -0.00419-0.01257i  +0.00314-0.00366i  +0.00681-0.00314i  -0.00262-0.00000i 

 Press return to continue. 


                 A        x  = b 
       Ab : [A-(EV1*Ide)] V1 = 0 
 +1.00000-0.00000i  +0.18750+0.31250i  +0.06250+0.56250i  +0.06250-0.18750i 
 +0.00000+0.00000i  -0.00000-0.00000i  +0.00000-0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  -0.00000-0.00000i  -0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000-0.00000i  -0.00000-0.00000i  +0.00000-0.00000i 

 -0.00000+0.00000i 
 +0.00000+0.00000i 
 +0.00000+0.00000i 
 +0.00000+0.00000i 

  Ab_free : [A-(EV1*Ide)] V1 = 0 
 +1.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +1.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +1.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +1.00000+0.00000i 

 +0.00000+0.00000i  -0.18750-0.31250i  -0.06250-0.56250i  -0.06250+0.18750i 
 +0.00000+0.00000i  +1.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +1.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +1.00000+0.00000i 

 Press return to continue. 


   b_free :
 +0.00000+0.00000i  -0.18750-0.31250i  -0.06250-0.56250i  -0.06250+0.18750i 
 +0.00000+0.00000i  +1.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +1.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +1.00000+0.00000i 

      V1 : Copy V1 into the next file
-0.176166065,-0.293610110, -0.054392830,-0.489535464, -0.061313934,+0.183941801,      -nan,    -nan, 
+0.939552351,+0.000000000, +0.000000000,+0.000000000, +0.000000000,+0.000000000,      -nan,    -nan, 
+0.000000000,+0.000000000, +0.870285269,+0.000000000, +0.000000000,+0.000000000,      -nan,    -nan, 
+0.000000000,+0.000000000, +0.000000000,+0.000000000, +0.981022943,+0.000000000,      -nan,    -nan  

 Press return to continue.