Aller au contenu

Mathc complexes/02a

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-5         
#define RCA          RC4 
#define EVALUE       RC1  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(void)
{                          
double a[RCA*(RCA*C2)] ={   
  +25072,   +0,   +21293,-4811,    +5386,-6531,   +11975,-5847, 
  +21293,+4811,   +30848,   +0,    -1526,-1774,   +13478,-6658, 
   +5386,+6531,    -1526,+1774,   +20007,   +0,    +7542,-1322, 
  +11975,+5847,   +13478,+6658,    +7542,+1322,   +21250,   +0  };
                       
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,C2);
double  **b_free  =                      i_mZ(    RCA,C2);

  clrscrn(); 
  printf("        A :");
  p_mZ(A, S8,P0, S6,P0, C4);  
  
         zmul_mZ(i_Z(EValue[EVALUE][C1],EValue[EVALUE][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,EVALUE); 

    Normalize_mZ(V);

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

//  printf(" sAmnszIde : A - (EVALUE%d*Ide)",EVALUE);                p_mZ(sAmnszIde, S9,P5, S8,P5, C4); 
  
//  printf("       Ab : [A-(EVALUE%d*Ide)] V%d = 0 ",EVALUE,EVALUE); p_mZ(Ab, S9,P5, S8,P5, C4);  

//  printf("   b_free :");                                           p_mZ(b_free, S9,P5, S8,P5, C4); 
        
//  printf("      V%d :",EVALUE);                                    p_mZ(V, S9,P5, S8,P5, C4); 
      
  stop();
              
  f_mZ(A);
  f_mZ(V);  
  f_mZ(EValue);
  
  f_mZ(Ide);
  f_mZ(zIde);
  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;
}
/* ------------------------------------ */
/* ------------------------------------ */


Étudier les calculs intermédiaires :  En supprimant les "//" vous pouvez observer les calculs intermédiaires


Exemple de sortie écran :
        A :
  +25072    +0i   +21293 -4811i    +5386 -6531i   +11975 -5847i 
  +21293 +4811i   +30848    +0i    -1526 -1774i   +13478 -6658i 
   +5386 +6531i    -1526 +1774i   +20007    +0i    +7542 -1322i 
  +11975 +5847i   +13478 +6658i    +7542 +1322i   +21250    +0i 

     zIde : EVALUE1 * Ide
 +0.61819-0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.61819-0.00000i  +0.00000+0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.61819-0.00000i  +0.00000+0.00000i 
 +0.00000+0.00000i  +0.00000+0.00000i  +0.00000+0.00000i  +0.61819-0.00000i 

 Press return to continue.