Mathc matrices/Conclusion

Un livre de Wikilivres.


Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define  TAB  C2 
#define  RCA  R5 
#define  POW   3  
/* ------------------------------------ */
void fun(void)
{
double **A[TAB];
double **A_n[TAB];

double **P    =   r_mR(  i_mR(RCA,RCA),99); 
double **InvP = inv_mR(P,i_mR(RCA,RCA)   );

double **T        = i_mR(RCA,RCA);
double **P_1A0_nP = i_mR(RCA,RCA);
int c;

  for(c=C0; c<TAB; c++)
     {   
         A[c] = i_mR(RCA,RCA); 
       A_n[c] = i_mR(RCA,RCA);   
	   }
	    
  rsymmetric_mR(A[R0],99);
  
  mul_mR(InvP,A[C0],T); 
  mul_mR(T,P,A[C0+C1]);

  clrscrn();
  printf(" The two similar matrices :\n\n"
         " A[%d] = P**(-1) A[%d] P   \n\n",C1,C0);
  for(c=C0; c<TAB; c++)
     {
	  printf(" A[%d] : ",c);      
      p_mR(A[c],S12,P2,C6); 
     }   
  stop();    

  clrscrn();      
  printf(" The two similar matrices at the power %d : \n\n",POW);     
    for(c=C0; c<TAB; c++)
     {
	  printf(" A[%d]**%d : ", c, POW);      
      p_mR(pow_mR(POW,A[c],A_n[c]),S12,P2,C6); 
     } 
  stop();    

   clrscrn();     
   mul_mR(InvP,A_n[C0],T); 
   mul_mR(T,P,P_1A0_nP);    
   printf(" A[%d]**%d = P**(-1) A[%d]**%d P \n\n",C1,POW,C0,POW); 
   printf(" A[%d]**%d : ",C1,POW);      
   p_mR(A_n[1],S12,P2,C6); 
   printf(" P**(-1) A[%d]**%d P : ",C0,POW);      
   p_mR(P_1A0_nP,S12,P2,C6); 


  for(c=C0; c<TAB; c++)
     { 
	   f_mR(A[c]);
	   f_mR(A_n[c]);
	   }
	   
  f_mR(P);		 
  f_mR(InvP); 	   
  f_mR(T); 
  f_mR(P_1A0_nP);       
}
/* ------------------------------------ */
int main(void)
{
time_t t;

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

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


Je crée une suite de deux Matrices semblables.


Exemple de sortie écran :
 --------------------------------
 The two similar matrices :

 A[1] = P**(-1) A[0] P   

 A[0] : 
      +29.00       -77.00       +45.00       -74.00       -27.00 
      -77.00       +97.00       +32.00       -39.00       -76.00 
      +45.00       +32.00       +49.00       +23.00       -10.00 
      -74.00       -39.00       +23.00       -98.00       +15.00 
      -27.00       -76.00       -10.00       +15.00       +51.00 

 A[1] : 
     +103.84      -111.24       -65.95       +38.92      +149.11 
     -137.12       +84.12      +120.63       -88.89      -199.79 
      -24.95       -45.63      +148.34       +10.03       -37.67 
      -63.02       +34.48      -110.99       +59.29       +40.05 
     -131.71       -58.86      +363.13      -123.27      -267.59 

 Press return to continue. 


 --------------------------------
 The two similar matrices at the power 3 : 

 A[0]**3 : 
   -30672.00  -1992633.00   +729395.00  -1813684.00    +91301.00 
 -1992633.00  +3142748.00   +883337.00  -1325859.00  -2152815.00 
  +729395.00   +883337.00   +223096.00   +635911.00   -438915.00 
 -1813684.00  -1325859.00   +635911.00  -2629723.00   -117009.00 
   +91301.00  -2152815.00   -438915.00   -117009.00  +1292466.00 

 A[1]**3 : 
 +3494166.41  -3861208.26   +492142.85  +2273488.18  +4542536.54 
 -4091855.44  +2756738.67  +1157665.66  -2942938.58  -5525979.72 
  -888939.54  -1341121.19  +2226323.60    -17675.49   -794180.62 
  -624296.29  +4116163.40  -3634926.25    +56097.66   -384945.31 
 -4787757.10  -3125114.03  +7645514.00  -3405747.19  -6535411.35 

 Press return to continue. 


 --------------------------------
 A[1]**3 = P**(-1) A[0]**3 P 

 A[1]**3 : 
 +3494166.41  -3861208.26   +492142.85  +2273488.18  +4542536.54 
 -4091855.44  +2756738.67  +1157665.66  -2942938.58  -5525979.72 
  -888939.54  -1341121.19  +2226323.60    -17675.49   -794180.62 
  -624296.29  +4116163.40  -3634926.25    +56097.66   -384945.31 
 -4787757.10  -3125114.03  +7645514.00  -3405747.19  -6535411.35 

 P**(-1) A[0]**3 P : 
 +3494166.41  -3861208.26   +492142.85  +2273488.18  +4542536.54 
 -4091855.44  +2756738.67  +1157665.66  -2942938.58  -5525979.72 
  -888939.54  -1341121.19  +2226323.60    -17675.49   -794180.62 
  -624296.29  +4116163.40  -3634926.25    +56097.66   -384945.31 
 -4787757.10  -3125114.03  +7645514.00  -3405747.19  -6535411.35 


 Press   return to continue
 Press X return to stop