Aller au contenu

Mathc complexes/a109

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-2      
#define RCA           RC4  
/* ------------------------------------ */       
/* ------------------------------------ */
void fun(int r)
{                          
double **A = rcsymmetric_mRZ(i_mZ(RCA,RCA),99);
double **V =                 i_mZ(RCA,RCA);
double **cV_T =              i_mZ(RCA,RCA);
double **T   =               i_mZ(RCA,RCA);

double **EValue     =        i_mZ(RCA,C1);
double **EigsValue  =        i_mZ(RCA,RCA);

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n\n");
  p_Octave_mRZ(A,"a",P0);  
  printf(" [V, E]  = eigs (a,%d) \n\n\n",RCA);

/* V and cV_T*/  
  eigs_V_mZ(A,V,FACTOR_E);
  
  printf(" V :");
  pE_mRZ(V, S12,P4, C4);
  printf(" cV_T :");
  pE_mRZ(ctranspose_mZ(V,cV_T), S12,P4, C4);
  stop();

  clrscrn();   
  eigs_mZ(A,EValue);
  
  printf(" EigsValue :"); 
  p_mRZ(EValue, S12,P4, C4);
 
/* EigsValue = cV_T * A * V */   
  mul_mZ(cV_T,A,T);
  mul_mZ(T,V,EigsValue); 
  
  printf(" EigsValue = cV_T * A * V");
  p_mRZ(EigsValue, S12,P4, C4);
        
  f_mZ(A);
  f_mZ(V);
  f_mZ(cV_T);
  f_mZ(EigsValue);
  f_mZ(EValue);
  f_mZ(T);    
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun(R3);
    
} while(stop_w());

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


              EValue = cV_T * A * V	


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


 a=[
+22011,+4547,+3926,+9012;
+4547,+12653,-3030,+1118;
+3926,-3030,+2896,+1382;
+9012,+1118,+1382,+12249]

 [V, E]  = eigs (a,4) 


 V :
 +8.3668e-01  +8.2658e-02  -4.7182e-01  -2.6554e-01 
 +2.4211e-01  -9.0986e-01  +8.6677e-02  +3.2562e-01 
 +1.2279e-01  +3.3433e-01  -2.3296e-01  +9.0492e-01 
 +4.7567e-01  +2.3140e-01  +8.4593e-01  +6.7734e-02 

 cV_T :
 +8.3668e-01  +2.4211e-01  +1.2279e-01  +4.7567e-01 
 +8.2658e-02  -9.0986e-01  +3.3433e-01  +2.3140e-01 
 -4.7182e-01  +8.6677e-02  -2.3296e-01  +8.4593e-01 
 -2.6554e-01  +3.2562e-01  +9.0492e-01  +6.7734e-02 

 Press return to continue. 

 ------------------------------------
 EigsValue :
 +29026.4441 
 +13068.9784 
  +6956.4827 
   +757.0947 

 EigsValue = cV_T * A * V
 +29026.4441      +0.0000      -0.0000      -0.0000 
     +0.0000  +13068.9784      -0.0000      -0.0000 
     -0.0000      -0.0000   +6956.4827      -0.0000 
     -0.0000      -0.0000      -0.0000    +757.0947 


 Press return to continue
 Press X      to stop