Aller au contenu

Mathc complexes/02s

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          RC6 
#define EV           RC1  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*(RCA*C2)] ={   
+2.547682339,+0.000000000, -0.152948221,-0.240121509, -0.155610012,-0.195690152, -0.298057299,-0.136017286, +0.269130276,-0.188132110, -0.030470880,+0.242003023, 
-0.152948221,+0.240121509, +2.509208904,-0.000000000, -0.155129068,+0.324099386, +0.216564361,-0.033484580, -0.042828351,-0.496677449, +0.294488953,+0.063493335, 
-0.155610012,+0.195690152, -0.155129068,-0.324099386, +2.260239854,-0.000000000, -0.143493743,+0.368327431, +0.532444321,-0.134971208, +0.126713301,-0.110092820, 
-0.298057299,+0.136017286, +0.216564361,+0.033484580, -0.143493743,-0.368327431, +2.122680989,+0.000000000, +0.151516032,+0.128430424, -0.310946484,-0.029309153, 
+0.269130276,+0.188132110, -0.042828351,+0.496677449, +0.532444321,+0.134971208, +0.151516032,-0.128430424, +2.282218238,-0.000000000, +0.206791187,+0.000458645, 
-0.030470880,-0.242003023, +0.294488953,-0.063493335, +0.126713301,+0.110092820, -0.310946484,+0.029309153, +0.206791187,-0.000458645, +2.277969677,+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("A :"); 
  p_mZ(A, S9,P5, S8,P5, C4); 
   
  stop();

         zmul_mZ(i_Z(EValue[EV][C1],EValue[EV][C2]),Ide,zIde);           
        MmnsD_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);  
  stop();
  
  clrscrn();
  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);  
  stop();
  
  clrscrn();
  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); 
  stop();
  
  clrscrn();        
  printf("      V%d : Copy V%d into the last file",EV,EV);  P_mZ(V, S9,P9, S8,P9, C3);    
  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 :
A :
 +2.54768+0.00000i  -0.15295-0.24012i  -0.15561-0.19569i  -0.29806-0.13602i 
 -0.15295+0.24012i  +2.50921-0.00000i  -0.15513+0.32410i  +0.21656-0.03348i 
 -0.15561+0.19569i  -0.15513-0.32410i  +2.26024-0.00000i  -0.14349+0.36833i 
 -0.29806+0.13602i  +0.21656+0.03348i  -0.14349-0.36833i  +2.12268+0.00000i 
 +0.26913+0.18813i  -0.04283+0.49668i  +0.53244+0.13497i  +0.15152-0.12843i 
 -0.03047-0.24200i  +0.29449-0.06349i  +0.12671+0.11009i  -0.31095+0.02931i 

 +0.26913-0.18813i  -0.03047+0.24200i 
 -0.04283-0.49668i  +0.29449+0.06349i 
 +0.53244-0.13497i  +0.12671-0.11009i 
 +0.15152+0.12843i  -0.31095-0.02931i 
 +2.28222-0.00000i  +0.20679+0.00046i 
 +0.20679-0.00046i  +2.27797+0.00000i 

 Press return to continue. 


     zIde : EV1 * Ide
 +0.30000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.30000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.30000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +0.30000+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  +0.00000+0.00000i 
 +0.30000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.30000+0.00000i 

 Press return to continue. 


 sAmnszIde : A - (EV1*Ide)
 -0.04523-0.00000i  -0.01529-0.02401i  -0.01556-0.01957i  -0.02981-0.01360i 
 -0.01529+0.02401i  -0.04908-0.00000i  -0.01551+0.03241i  +0.02166-0.00335i 
 -0.01556+0.01957i  -0.01551-0.03241i  -0.07398-0.00000i  -0.01435+0.03683i 
 -0.02981+0.01360i  +0.02166+0.00335i  -0.01435-0.03683i  -0.08773-0.00000i 
 +0.02691+0.01881i  -0.00428+0.04967i  +0.05324+0.01350i  +0.01515-0.01284i 
 -0.00305-0.02420i  +0.02945-0.00635i  +0.01267+0.01101i  -0.03109+0.00293i 

 +0.02691-0.01881i  -0.00305+0.02420i 
 -0.00428-0.04967i  +0.02945+0.00635i 
 +0.05324-0.01350i  +0.01267-0.01101i 
 +0.01515+0.01284i  -0.03109-0.00293i 
 -0.07178-0.00000i  +0.02068+0.00005i 
 +0.02068-0.00005i  -0.07220-0.00000i 

 Press return to continue. 


                 A        x  = b 
       Ab : [A-(EV1*Ide)] V1 = 0 
 +1.00000+0.00000i  +0.33814+0.53087i  +0.34403+0.43264i  +0.65896+0.30071i 
 +0.00000+0.00000i  +1.00000+0.00000i  -0.20077-0.65950i  -1.44125+0.53912i 
 -0.00000+0.00000i  -0.00000+0.00000i  +1.00000+0.00000i  +0.41731+0.33282i 
 +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.59500+0.41593i  +0.06737-0.53503i  -0.00000+0.00000i 
 +0.35002+0.72474i  -0.98563-0.13943i  +0.00000+0.00000i 
 -0.78775-0.26340i  +0.00270+1.27871i  -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 

 Press return to continue. 


  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.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  -1.66040-0.54487i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +1.57696-0.88116i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  -0.41731-0.33282i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +1.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.48071-0.60177i  -1.30113+0.04573i 
 -0.36558-0.15233i  +1.82839-0.11907i 
 +0.78775+0.26340i  -0.00270-1.27871i 
 +0.00000-0.00000i  -0.00000-0.00000i 
 +1.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  -1.66040-0.54487i  +0.48071-0.60177i  -1.30113+0.04573i 
 +0.00000+0.00000i  +1.57696-0.88116i  -0.36558-0.15233i  +1.82839-0.11907i 
 +0.00000+0.00000i  -0.41731-0.33282i  +0.78775+0.26340i  -0.00270-1.27871i 
 +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. 


      V1 : Copy V1 into the last file
-0.602212108,-0.197619446, +0.307741070,-0.385245122, -0.469280304,+0.016495099, 
+0.571949714,-0.319588195, -0.234041354,-0.097520343, +0.659450230,-0.042946794, 
-0.151354225,-0.120711483, +0.504304725,+0.168627883, -0.000973596,-0.461193853, 
+0.362690886,-0.000000000, +0.000000000,-0.000000000, -0.000000000,-0.000000000, 
+0.000000000,+0.000000000, +0.640185472,+0.000000000, +0.000000000,+0.000000000, 
+0.000000000,+0.000000000, -0.000000000,+0.000000000, +0.360671813,+0.000000000, 

     -nan,    -nan,      -nan,    -nan,      -nan,    -nan, 
     -nan,    -nan,      -nan,    -nan,      -nan,    -nan, 
     -nan,    -nan,      -nan,    -nan,      -nan,    -nan, 
     -nan,    -nan,      -nan,    -nan,      -nan,    -nan, 
     -nan,    -nan,      -nan,    -nan,      -nan,    -nan, 
     -nan,    -nan,      -nan,    -nan,      -nan,    -nan  

 Press return to continue.