Aller au contenu

Mathc matrices/a91

Un livre de Wikilivres.


Application


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


c00c.c
/* ------------------------------------ */
/*  Save as :  c00c.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define  ARRAY  A3 
#define    RCA  R3  
/* ------------------------------------ */
void fun(void)
{
double **A[ARRAY];
double **P[ARRAY];
double **InvP[ARRAY];

double **T         = i_mR(RCA,RCA);
double **EigsValue = i_mR(RCA,C1);

int i;

  for(i=A0; i<ARRAY; i++)
     {   
         A[i] =              i_mR(RCA,RCA); 
         P[i] =   r_mR(      i_mR(RCA,RCA),999); 
      InvP[i] = inv_mR(P[i], i_mR(RCA,RCA));       
	   } 

  rsymmetric_mR(A[0],99);
  
    for(i=A0; i<(ARRAY-C1); i++)
     {   
        mul_mR(InvP[i],A[i],T); 
        mul_mR(T,P[i],A[i+C1]);
	   } 

  clrscrn();
  for(i=A0; i<ARRAY; i++)
     {
	  printf(" A[%d] : ",i); 
      p_mR(A[i],S9,P2,C6);
      
	  printf(" EigsValue  of A[%d] : ",i); 
	  eigs_mR(A[i],EigsValue); 
      p_mR(EigsValue, S9,P2,C6); 
     } 
     
  printf(" Similar matrices have the eignvalues.\n\n");
	  
  for(i=A0; i<ARRAY; i++)
     { 
	   f_mR(A[i]);
	   f_mR(P[i]);		 
	   f_mR(InvP[i]); 
	   }
	   
  f_mR(T);       
  f_mR(EigsValue); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
  do{
        fun();
        
  }while(stop_w());

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


Exemple de sortie écran :
 A[0] : 
   -21.00    +21.00    -29.00 
   +21.00    -93.00    +66.00 
   -29.00    +66.00    +36.00 

 EigsValue  of A[0] : 
  -129.56 
   +67.90 
   -16.34 

 A[1] : 
   +48.30     -8.72     +2.97 
  -217.95    +78.40    +97.83 
  +393.33   -178.13   -204.70 

 EigsValue  of A[1] : 
  -129.56 
   +67.90 
   -16.34 

 A[2] : 
 +1426.82   +875.89  -1936.54 
   +28.23     +0.60    -39.64 
 +1104.25   +669.35  -1505.42 

 EigsValue  of A[2] : 
  -129.56 
   +67.90 
   -16.34 

 Similar matrices have the eignvalues.


 Press   return to continue
 Press X return to stop