Aller au contenu

Mathc complexes/a320

Un livre de Wikilivres.



Valeurs propres


Installer et compiler ces fichiers dans votre répertoire de travail.


c00a.c
/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int rc)
{
double **A         = rupper_mZ(i_mZ(rc,rc),9.);
double **EigsValue =           i_mZ(rc,C1);

nb_Z s = {0,0};
int  r =     0;
int  c =     0;

  clrscrn();

  printf(" A :");
  p_mZ(A,S5,P0,S4,P0,C6);
       
  printf(" EigsValue :");
  p_mZ(eigs_mZ(A,EigsValue),S5,P0,S4,P0,C6);   
  
  for (r=R1,c=C1; r<A[R_SIZE][C0]; r++,c+=C2)
  
          s = add_Z(s, i_Z(A[r][c],A[r][c+C1]));
                  
  printf(" Sum of the eigenvalues of A = ");
  p_Z(s, S5,P0, S4,P0); printf("\n"); 
  
  printf(" Trace of the matrix A       = "); 
  p_Z(trace_Z(A), S5,P0, S4,P0); printf("\n\n\n");
   
  f_mZ(A);
  f_mZ(EigsValue);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
 fun(rp_I(R3)+R1);

} while(stop_w());

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


Exemple de sortie écran :
 A :
   -7  -6i    +2  +8i    +5  +3i    +6  -4i 
   +0  +0i    +7  -6i    -5  +7i    -7  -5i 
   +0  +0i    +0  +0i    +8  +2i    -9  -2i 
   +0  +0i    +0  +0i    +0  +0i    -2  +3i 

 EigsValue :
   -7  -6i 
   +7  -6i 
   +8  +2i 
   -2  +3i 

 Sum of the eigenvalues of A =    +6  -7i 
 Trace of the matrix A       =    +6  -7i 



 Press   return to continue
 Press X return to stop