Mathc matrices/c24h

Un livre de Wikilivres.


Application


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


c00b.c
/* ------------------------------------ */
/*  Save as :  c00b.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define   RB R3
#define   CB C2

#define   RU R2
#define   CU C1
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double bu_s[RB*(CB+CU)]={
    +2,  2,      6,
    +2,  0,     14,
    +6,  2,     34, 
};

double **Bu_s = ca_A_mR(bu_s,i_Abr_Ac_bc_mR(RB,CB,CU));
double **B    = c_Ab_A_mR(Bu_s,i_mR(RB,CB));
double **U_s  = c_Ab_b_mR(Bu_s,i_mR(RB,CU));

  clrscrn();
  printf(" B is the change of basis matrix for \"B\" \n\n"
         " Find the coordinate of U in the \"B\" basis.\n\n"
         " B :   ");
  p_mR(B,S6,P0,C7);
  printf( " U_s :   the coordinate of U in the Standard basis");
  p_mR(U_s,S6,P2,C7);
  stop();
  
  clrscrn();
  printf(" Bu_s :");
  p_mR(Bu_s,S6,P2,C7);
//  stop();

//  clrscrn();
//  printf(" Copy/Past into the octave window.\n\n");
//  p_Octave_mR(Bu_s,"Ab",P0);
//  printf("\n rref(Ab,.00000000001)\n\n");
  
  printf(" Bu_s : gj_PP_mR(Ab,YES) :");
  gj_PP_mR(Bu_s,YES);
  p_mR(Bu_s,S6,P2,C7);
  stop();
  
  clrscrn();
  printf(" Bu_s : gj_PP_mR(Ab,YES) :");
  p_mR(Bu_s,S6,P2,C7);
  printf( " U_s :   the coordinate of U in the Standard basis");
  p_mR(U_s,S6,P2,C7);
  printf(" U_b :   the coordinate of U in the \"B\" basis\n"
         "  %+.2f\n  %+.2f\n\n", Bu_s[R1][C3],Bu_s[R2][C3]);
  stop();
   
  f_mR(Bu_s);
  f_mR(U_s);
  f_mR(B);
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Matrice de passage inversible :

Soit B la matrice de changement de base de B
Trouver les coordonnées de U dans la base B : 
       B * U_b = U_s                       A*x = b
       
       B|U_s                               A|b


Exemple de sortie écran :
 ------------------------------------ 
 B is the change of basis matrix for "B" 

 Find the coordinate of U in the "B" basis.

 B :   
    +2     +2 
    +2     +0 
    +6     +2 

 U_s :   the coordinate of U in the Standard basis
 +6.00 
+14.00 
+34.00 

 Press return to continue. 


 ------------------------------------ 
 Bu_s :
 +2.00  +2.00  +6.00 
 +2.00  +0.00 +14.00 
 +6.00  +2.00 +34.00 

 Bu_s : gj_PP_mR(Ab,YES) :
 +1.00  +0.00  +7.00 
 +0.00  +1.00  -4.00 
 +0.00  +0.00  +0.00 

 Press return to continue. 


 ------------------------------------ 
 Bu_s : gj_PP_mR(Ab,YES) :
 +1.00  +0.00  +7.00 
 +0.00  +1.00  -4.00 
 +0.00  +0.00  +0.00 

 U_s :   the coordinate of U in the Standard basis
 +6.00 
+14.00 
+34.00 

 U_b :   the coordinate of U in the "B" basis
  +7.00
  -4.00

 Press return to continue.