Aller au contenu

Mathc matrices/cq053

Un livre de Wikilivres.


Application


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

cq3.c
/* ------------------------------------ */
/*  Save as :   cq3.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A = r_Q_mR(i_mR(r,r), 9);
double **B = r_Q_mR(i_mR(r,r), 9);
double **AB  =      i_mR(r,r);
double **ABT =      i_mR(r,r);
double **T   =      i_mR(r,r);

  clrscrn();
  printf(" A :                an orthonormal matrix ");
  p_mR(A,S3,P3,C6); 
  printf(" B :                an orthonormal matrix ");
  p_mR(B,S3,P3,C6);
  stop();

  clrscrn();
  printf("   A * B  = AB  :   AB is an orthonormal matrix");
  mul_mR(A,B,AB);
  p_mR(AB,S3,P3,C6);    

  printf(" AB * ABT = id :    inv(AB) = ABT ");
  transpose_mR(AB,ABT);
  mul_mR(AB,ABT,T);
  p_mR(T,S3,P3,C6);    
  
  f_mR(A);
  f_mR(B);
  f_mR(AB);
  f_mR(ABT);
  f_mR(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(R3)+R2);

} while(stop_w());

  return 0;
}

/* ------------------------------------ */
/* ------------------------------------ */


Le produit de deux matrices orthogonales est orthogonale :   


Exemple de sortie écran :
 A :                an orthonormal matrix 
-0.199 +0.456 -0.160 +0.805 +0.281 
+0.597 +0.477 +0.112 -0.296 +0.562 
-0.299 +0.443 +0.801 -0.075 -0.259 
+0.597 -0.405 +0.457 +0.507 -0.114 
-0.398 -0.452 +0.333 -0.030 +0.725 

 B :                an orthonormal matrix 
+0.273 -0.738 +0.484 +0.054 +0.379 
+0.479 -0.094 +0.220 +0.152 -0.831 
+0.615 +0.580 +0.193 +0.302 +0.395 
-0.137 +0.307 +0.666 -0.663 -0.058 
+0.547 -0.125 -0.486 -0.666 +0.078 

 Press return to continue. 



   A * B  = AB  :   AB is an orthonormal matrix
+0.109 +0.224 +0.373 -0.710 -0.542 
+0.808 -0.582 -0.055 -0.038 -0.065 
+0.492 +0.653 +0.183 +0.515 -0.181 
+0.119 +0.033 +0.681 -0.152 +0.705 
+0.280 +0.429 -0.600 -0.453 +0.414 

 AB * ABT = id :    inv(AB) = ABT 
+1.000 -0.000 +0.000 -0.000 +0.000 
-0.000 +1.000 -0.000 +0.000 +0.000 
+0.000 -0.000 +1.000 -0.000 -0.000 
-0.000 +0.000 -0.000 +1.000 -0.000 
+0.000 +0.000 -0.000 -0.000 +1.000 


 Press return to continue
 Press X      to stop