Aller au contenu

Mathc matrices/c17d

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  A7 
#define    RCA  R4 
/* ------------------------------------ */
void fun(void)
{
double **A[ARRAY];
double **P[ARRAY];
double **InvP[ARRAY];

double **T      = i_mR(RCA,RCA);
double **EValue = 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(" EValue  of A[%d]: ",i); 
	  eigs_mR(A[i],EValue); 
      p_mR(EValue, S9,P2,C6); 
     } 
     
  printf(" Similar matrices have the eigenvalues.\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(EValue); 
}
/* ------------------------------------ */
int main(void)
{
time_t t;

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

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
 A[0]: 
   +62.00    +57.00    +86.00    -58.00 
   +57.00     +9.00    +60.00    +78.00 
   +86.00    +60.00    +62.00    -10.00 
   -58.00    +78.00    -10.00    -90.00 

 EValue  of A[0]: 
  +187.03 
  -161.07 
   +43.06 
   -26.02 

 A[1]: 
  -194.67   +419.18   -670.91   -223.39 
   +51.98    -16.80   -150.90    +14.42 
   +10.43     -0.04    +95.51    +16.47 
  +110.90   -385.32   +666.67   +158.96 

 EValue  of A[1]: 
  +187.03 
  -161.07 
   +43.06 
   -26.02 

 A[2]: 
  +865.90   +956.10   -490.60   +734.37 
  -412.23   -480.16   +125.00   -282.24 
  -458.32   -554.23    +97.48   -289.90 
  -728.82   -842.73    +83.33   -440.22 

 EValue  of A[2]: 
  +187.03 
  -161.07 
   +43.06 
   -26.02 

 A[3]: 
  -990.58   +889.79   -328.06   -913.50 
  +566.35   -559.90   +173.90   +594.96 
 +2600.40  -2274.01   +910.71  +2211.15 
  +990.55   -851.72   +403.77   +682.77 

 EValue  of A[3]: 
  +187.03 
  -161.07 
   +43.06 
   -26.02 

 A[4]: 
   -69.55  +4998.57  +8911.64  -7152.55 
   +17.90  -3244.37  -5634.92  +4424.53 
   -25.50  +2840.96  +5053.06  -4091.80 
    +1.11  +1177.80  +2076.29  -1696.14 

 EValue  of A[4]: 
  +187.03 
  -161.07 
   +43.06 
   -26.02 

 A[5]: 
+18550.69 -20269.82  +6364.71  +9058.55 
+13371.78 -14666.36  +4509.44  +6495.68 
 -8531.36  +9279.72  -2988.52  -4181.44 
 -1635.85  +1749.43   -607.23   -852.81 

 EValue  of A[5]: 
  +187.03 
  -161.07 
   +43.06 
   -26.02 

 A[6]: 
-47625.99 +44681.42  -7509.77 -74380.95 
-36073.60 +33805.35  -5741.69 -56543.50 
-12333.28 +11582.80  -1971.80 -19253.13 
+10209.76  -9598.79  +1581.23 +15835.44 

 EValue  of A[6]: 
  +187.03 
  -161.07 
   +43.06 
   -26.02 

 Similar matrices have the eigenvalues.


 Press   return to continue
 Press X return to stop