Aller au contenu

Mathc matrices/a232

Un livre de Wikilivres.


Produit scalaire canonique dans Rn


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

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **U             = r_mR(i_mR(r,r),9.);
double **Orth          =      i_mR(r,r);
double **Orth_Normal   =      i_mR(r,r);
double **Orth_Normal_T =      i_mR(r,r);

  clrscrn();
  printf(" U :");
  p_mR(U, S8,P4, C6); 

  orth_mR(U,Orth,NO);

  printf(" Orth :");
  p_mR(Orth, S8,P4, C6);  
  stop();

  clrscrn();
  printf(" Orth_Normal :");
  normalize_mR(Orth,Orth_Normal);
  p_mR(Orth_Normal, S8,P4, C6); 
  
  printf(" Orth_Normal_T :");
  transpose_mR(Orth_Normal,Orth_Normal_T);
  p_mR(Orth_Normal_T, S8,P4, C6); 
    
  printf(" Orth_Normal_T * Orth_Normal  :");
  mul_mR(Orth_Normal_T,Orth_Normal, U);
  p_mR(U, S8,P4, C6);  
    
  f_mR(U);
  f_mR(Orth);
  f_mR(Orth_Normal);  
  f_mR(Orth_Normal_T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun(rp_I(R2)+R2);
} while(stop_w());

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


Exemple de sortie écran :
 -------------------------------
 U :
 +7.0000  -4.0000  -3.0000  -7.0000 
 -5.0000  -3.0000  -9.0000  +1.0000 
 +6.0000  -3.0000  +7.0000  +7.0000 
 -9.0000  +6.0000  +7.0000  -9.0000 

 Orth :
 +7.0000  -0.8848  -1.4231  -9.3842 
 -5.0000  -5.2251  +1.0399  -0.8205 
 +6.0000  -0.3298  +7.5346  +1.0598 
 -9.0000  +1.9948  +3.3385  -6.1365 

 Press return to continue. 


 -------------------------------
 Orth_Normal :
 +0.5065  -0.1560  -0.1689  -0.8310 
 -0.3618  -0.9212  +0.1234  -0.0727 
 +0.4341  -0.0582  +0.8941  +0.0939 
 -0.6512  +0.3517  +0.3961  -0.5434 

 Orth_Normal_T :
 +0.5065  -0.3618  +0.4341  -0.6512 
 -0.1560  -0.9212  -0.0582  +0.3517 
 -0.1689  +0.1234  +0.8941  +0.3961 
 -0.8310  -0.0727  +0.0939  -0.5434 

 Orth_Normal_T * Orth_Normal  :
 +1.0000  +0.0000  -0.0000  +0.0000 
 +0.0000  +1.0000  -0.0000  +0.0000 
 -0.0000  -0.0000  +1.0000  -0.0000 
 +0.0000  +0.0000  -0.0000  +1.0000 


 Press   return to continue
 Press X return to stop