Aller au contenu

Mathc matrices/c26f

Un livre de Wikilivres.


Application


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

cq5.c
/* ------------------------------------ */
/*  Save as :   cq5.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RA R3
#define   CA C3
#define   CB C3
/* ------------------------------------ */
void fun(void)
{
double ta[RA*CA]={
-0.719184408316, +0.554628943479, +0.418521829646, 
+0.693499250876, +0.535876212097, +0.481555266136, 
+0.042808595733, +0.636571614482, -0.770028573344    
};
double tb[RA*CB]={
 +90.0000,  -88.0000,  +26.0000, 
 -79.0000,  +60.0000,  -67.0000, 
 +77.0000,  -34.0000,  +33.0000  
};

double **A  = ca_A_mR(ta,i_mR(RA,CA));
double **B  = ca_A_mR(tb,i_mR(RA,CB));
double **Ab = i_Abr_Ac_bc_mR(RA,CA,CB);

double **b[CB];
double **a[CA];

int c;

  clrscrn();
  printf(" A : Orthonormal");
  p_mR(A,S9,P4,C6);

  printf("  b[C0]     b[C1]     b[C2]  :");
  p_mR(B,S9,P4,C6);
 
  printf(" Ab :");
  c_A_b_Ab_mR(A,B,Ab);
  p_mR(Ab,S9,P4,C6);

  printf("  gj_TP_mR(Ab) :               x[C0]     x[C1]     x[C2]");
  gj_TP_mR(Ab);
  p_mR(Ab,S9,P4,C6);
  stop();
  
/* ------------------------------------ */
/* ------------------------------------ */
  for(c=C0; c<CB; c++)
     {
      b[c] = i_mR(RA,C1);      
      c_c_mR(B,(c+C1),b[c],C1); }  
      
  for(c=C0; c<CA; c++)
     {
      a[c] = i_mR(RA,C1);      
      c_c_mR(A,(c+C1),a[c],C1); }  
/* ------------------------------------ */
/* ------------------------------------ */ 

  clrscrn();      
  for(c=C0; c<CA; c++)
     {
      printf(" a[%d] :",c);      
      pE_mR(a[c],S12,P4,C6); }        
  stop();
  
  clrscrn(); 
  for(c=C0; c<CB; c++)
     {
      printf(" b[%d] :",c);      
      p_mR(b[c],S12,P4,C6); }  
  stop();
 
  clrscrn();       
  printf(" x[C0] :\n");        
  for(c=C0; c<RA; c++)   
      printf("%+15.7f   <b[C0],a[%d]>\n",dot_R(b[C0],a[c]), c);       
      
  printf("\n x[C1] :\n");        
  for(c=C0; c<RA; c++)   
      printf("%+15.7f   <b[C1],a[%d]>\n",dot_R(b[C1],a[c]), c); 

  printf("\n x[C2] :\n");        
  for(c=C0; c<RA; c++)   
      printf("%+15.7f   <b[C2],a[%d]>\n",dot_R(b[C2],a[c]), c);        
 
  printf("\n  gj_TP_mR(Ab) :\t\t\t x[C0]        x[C1]         x[C2]");
  p_mR(Ab,S12,P7,C6); 
  stop();
  
/* ------------------------------------ */
/* ------------------------------------ */       
  for(c=C0; c<CA; c++)  
       f_mR(a[c]); 
      
  for(c=C0; c<CB; c++)  
       f_mR(b[c]); 
/* ------------------------------------ */
/* ------------------------------------ */ 

  f_mR(Ab);
  f_mR(B);
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{

  fun();

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


Résoudre un système d'équation quand A est une matrice orthonormale :  

Ici B est composé de trois vecteurs. 



Exemple de sortie écran :
 --------------------------------
 A : Orthonormal
  -0.7192   +0.5546   +0.4185 
  +0.6935   +0.5359   +0.4816 
  +0.0428   +0.6366   -0.7700 

  b[C0]     b[C1]     b[C2]  :
 +90.0000  -88.0000  +26.0000 
 -79.0000  +60.0000  -67.0000 
 +77.0000  -34.0000  +33.0000 

 Ab :
  -0.7192   +0.5546   +0.4185  +90.0000  -88.0000  +26.0000 
  +0.6935   +0.5359   +0.4816  -79.0000  +60.0000  -67.0000 
  +0.0428   +0.6366   -0.7700  +77.0000  -34.0000  +33.0000 

  gj_TP_mR(Ab) :                x[C0]     x[C1]     x[C2]
  +1.0000   -0.0000   -0.0000 -116.2168 +103.4427  -63.7506 
  +0.0000   +1.0000   +0.0000  +56.5984  -38.2982   -0.4765 
  +0.0000   +0.0000   +1.0000  -59.6681  +18.2444  -46.7936 

 Press return to continue. 


 --------------------------------
 a[0] :
 -7.1918e-01 
 +6.9350e-01 
 +4.2809e-02 

 a[1] :
 +5.5463e-01 
 +5.3588e-01 
 +6.3657e-01 

 a[2] :
 +4.1852e-01 
 +4.8156e-01 
 -7.7003e-01 

 Press return to continue. 


 --------------------------------
 b[0] :
    +90.0000 
    -79.0000 
    +77.0000 

 b[1] :
    -88.0000 
    +60.0000 
    -34.0000 

 b[2] :
    +26.0000 
    -67.0000 
    +33.0000 

 Press return to continue. 


 --------------------------------
 x[C0] :
   -116.2167757   <b[C0],a[0]>
    +56.5983985   <b[C0],a[1]>
    -59.6681015   <b[C0],a[2]>

 x[C1] :
   +103.4426907   <b[C1],a[0]>
    -38.2982092   <b[C1],a[1]>
    +18.2443665   <b[C1],a[2]>

 x[C2] :
    -63.7505608   <b[C2],a[0]>
     -0.4764904   <b[C2],a[1]>
    -46.7935782   <b[C2],a[2]>

  gj_TP_mR(Ab) :			            x[C0]        x[C1]         x[C2]
  +1.0000000   -0.0000000   -0.0000000 -116.2167757 +103.4426907  -63.7505608 
  +0.0000000   +1.0000000   +0.0000000  +56.5983985  -38.2982092   -0.4764904 
  +0.0000000   +0.0000000   +1.0000000  -59.6681015  +18.2443665  -46.7935782 

 Press return to continue.