Aller au contenu

Mathc matrices/a92

Un livre de Wikilivres.


Application


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


c00e.c
/* ------------------------------------ */
/*  Save as :  c00e.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define  ARRAY  A2 
#define    RCA  R5  
/* ------------------------------------ */
void fun(void)
{
double **A[ARRAY];
double **InvA[ARRAY];

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 **InvP_InvA0_P =           i_mR(RCA,RCA);
int i;

  for(i=A0; i<ARRAY; i++)
     {   
          A[i] = i_mR(RCA,RCA); 
       InvA[i] = i_mR(RCA,RCA);   
	   }
	    
  rsymmetric_mR(A[R0],99);
  
  mul_mR(InvP,A[A0],T); 
  mul_mR(T,P,A[A0+A1]);

  clrscrn();
  printf(" The two similar matrices :\n\n"
         " A[%d] = InvP A[%d] P   \n\n",A1,A0);
  for(i=A0; i<ARRAY; i++)
     {
	  printf(" A[%d] : ",i);      
      p_mR(A[i], S12,P4,C6); 
     }   
  stop();    

   clrscrn();
   
   for(i=A0; i<ARRAY; i++)
      {
       inv_mR(A[i],InvA[i]); 
       }       
          
   mul_mR(InvP,InvA[A0],T); 
   mul_mR(T,P,InvP_InvA0_P);  
     
   printf(" If   A[%d] = InvP A[%d] P    Then   "
          " InVA[%d] = InvP InVA[%d] P \n\n",A1,A0 ,A1,A0); 
   printf(" InVA[%d] : ",A1);      
   pE_mR(InvA[1], S12,P4,C6); 
   
   printf(" InvP InVA[%d] P : ",A0);      
   pE_mR(InvP_InvA0_P, S12,P4,C6);  

  for(i=A0; i<ARRAY; i++)
     { 
	   f_mR(A[i]);
	   f_mR(InvA[i]);
	   }
	   
  f_mR(P);		 
  f_mR(InvP); 	   
  f_mR(T); 
  f_mR(InvP_InvA0_P);       
}
/* ------------------------------------ */
int main(void)
{
time_t t;

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

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


Exemple de sortie écran :
 The two similar matrices :

 A[1] = InvP A[0] P   

 A[0] : 
    -23.0000     +29.0000     -76.0000     +73.0000      +9.0000 
    +29.0000     +69.0000     +12.0000     -97.0000      -3.0000 
    -76.0000     +12.0000     +71.0000     +14.0000     -77.0000 
    +73.0000     -97.0000     +14.0000     +13.0000     +22.0000 
     +9.0000      -3.0000     -77.0000     +22.0000     -58.0000 

 A[1] : 
   +160.6557    +180.0079    +150.8756    -168.1268    +173.7829 
     -6.0943     +42.6520    -170.8602     +37.9584     -54.0106 
    +23.3216     -61.0299     +74.0163     +67.3560     +90.3242 
     +5.3686     +63.8665      +6.8448     +19.0327     +54.7522 
    -92.1865    -111.5524    -126.7157      -2.9952    -224.3566 

 Press return to continue. 


 If   A[1] = InvP A[0] P    Then    InVA[1] = InvP InVA[0] P 

 InVA[1] : 
 +2.9940e-02  +9.3866e-03  +5.4305e-02  +6.2719e-02  +5.8100e-02 
 +1.3567e-02  -7.0307e-04  +2.0577e-02  +5.3460e-02  +3.2008e-02 
 +1.6299e-02  -5.6280e-03  +2.9920e-02  +5.5544e-02  +3.9580e-02 
 +2.2302e-02  +2.7880e-03  +4.8990e-02  +7.9380e-02  +5.5699e-02 
 -2.8551e-02  -3.6587e-04  -5.0097e-02  -8.4782e-02  -6.7343e-02 

 InvP InVA[0] P : 
 +2.9940e-02  +9.3866e-03  +5.4305e-02  +6.2719e-02  +5.8100e-02 
 +1.3567e-02  -7.0307e-04  +2.0577e-02  +5.3460e-02  +3.2008e-02 
 +1.6299e-02  -5.6280e-03  +2.9920e-02  +5.5544e-02  +3.9580e-02 
 +2.2302e-02  +2.7880e-03  +4.8990e-02  +7.9380e-02  +5.5699e-02 
 -2.8551e-02  -3.6587e-04  -5.0097e-02  -8.4782e-02  -6.7343e-02 


 Press   return to continue
 Press X return to stop