Aller au contenu

Mathc matrices/c33 1b

Un livre de Wikilivres.


Application

Installer et compiler ce fichier dans votre répertoire de travail.

c01b.c
/* ------------------------------------ */
/*  Save as :   c01b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void AplsB(int r)
{
double **A  = i_mR(r,r);
double **B  = i_mR(r,r);
double **C  = i_mR(r,r);
double **T  = i_mR(r,r);
double **AB = i_mR(r,r);
double **BA = i_mR(r,r);

   r_commute3_mR(A,B,C,9);

  clrscrn();
  printf(" A : ");
  p_mR(A,S5,P3,C6);                                
  printf(" B : ");
  p_mR(B,S5,P3,C6);
  printf(" C : ");
  p_mR(C,S5,P3,C6);       
  stop();

  clrscrn();
  printf(" AB : ");
  p_mR(mul_mR(A,B,AB),S5,P9,C6);
  printf(" BA : ");
  p_mR(mul_mR(B,A,BA),S5,P9,C6);
  stop();

  clrscrn();
  printf(" AC : ");
  p_mR(mul_mR(A,C,AB),S5,P9,C6);
  printf(" CA : ");
  p_mR(mul_mR(C,A,BA),S5,P9,C6);
  stop();

  clrscrn();
  printf(" BC : ");
  p_mR(mul_mR(B,C,AB),S5,P9,C6);
  printf(" CB : ");
  p_mR(mul_mR(C,B,BA),S5,P9,C6);   
  
  
  f_mR(A);
  f_mR(B);
  f_mR(C);
  f_mR(AB);
  f_mR(BA);
  f_mR(T);
}
/* ------------------------------------ */
void hello(void)
{
  
  printf("\n                                                  ");
  printf("\n     Three Commutative matrices                    ");
  printf("\n            ****************                    \n");
  printf("\n                                                  ");
  printf("\n                                                  ");
  printf("\n                                                \n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  hello();

do
{
  AplsB(RC3);

} while(stop_w());

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


  Tester la bibliothèque.


Exemple de sortie écran :

 AB : 
+0.450715570 +0.083759959 +0.061396170 
+0.169973885 +0.258134797 -0.295567475 
+0.313486289 -0.029858858 -0.321378408 

 BA : 
+0.450715570 +0.083759959 +0.061396170 
+0.169973885 +0.258134797 -0.295567475 
+0.313486289 -0.029858858 -0.321378408 

 Press return to continue. 


 AC : 
-0.259535308 -0.089131965 +0.011996920 
-0.064293277 -0.035416992 +0.010180431 
-0.097791671 -0.032009368 +0.004797914 

 CA : 
-0.259535308 -0.089131965 +0.011996920 
-0.064293277 -0.035416992 +0.010180431 
-0.097791671 -0.032009368 +0.004797914 

 Press return to continue. 


 BC : 
-0.224994728 -0.065318703 +0.004816116 
-0.053109656 -0.061740160 +0.023106949 
-0.083787386 -0.020178350 -0.002633096 

 CB : 
-0.224994728 -0.065318703 +0.004816116 
-0.053109656 -0.061740160 +0.023106949 
-0.083787386 -0.020178350 -0.002633096