Aller au contenu

Mathc complexes/02i

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          RC3 
#define EV           RC2  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*(RCA*C2)] ={   
+1.344121661,+0.000000000, -0.056736206,-0.111717684, -0.178397348,+0.422109573, 
-0.056736206,+0.111717684, +1.045622928,+0.000000000, -0.107623318,-0.127510236, 
-0.178397348,-0.422109573, -0.107623318,+0.127510236, +1.610255410,+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,C3);
double  **b_free  =                      i_mZ(    RCA,C3);

  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);           
        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); 
          
    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 deux valeurs propres identiques


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

 a=[
+1.344121661+0.000000000*i,-0.056736206-0.111717684*i,-0.178397348+0.422109573*i;
-0.056736206+0.111717684*i,+1.045622928+0.000000000*i,-0.107623318-0.127510236*i;
-0.178397348-0.422109573*i,-0.107623318+0.127510236*i,+1.610255410+0.000000000*i]

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

 Press return to continue. 


     zIde : EV2 * Ide
 +0.10000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.10000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.10000+0.00000i 

 sAmnszIde : A - (EV2*Ide)
 +0.03441-0.00000i  -0.00567-0.01117i  -0.01784+0.04221i 
 -0.00567+0.01117i  +0.00456-0.00000i  -0.01076-0.01275i 
 -0.01784-0.04221i  -0.01076+0.01275i  +0.06103-0.00000i 

 Press return to continue. 


                 A        x  = b 
       Ab : [A-(EV2*Ide)] V2 = 0 
 +1.00000+0.00000i  -0.16487-0.32465i  -0.51841+1.22663i  -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-(EV2*Ide)] V2 = 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.16487+0.32465i  +0.51841-1.22663i 
 +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  +0.16487+0.32465i  +0.51841-1.22663i 
 +0.00000+0.00000i  +1.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +1.00000+0.00000i 

      V2 : Copy V2 into the next file
     -nan,    -nan, +0.154922408,+0.305053400, +0.311295176,-0.736561811, 
     -nan,    -nan, +0.939649653,+0.000000000, +0.000000000,+0.000000000, 
     -nan,    -nan, +0.000000000,+0.000000000, +0.600476487,+0.000000000  

 Press return to continue.