Mathc matrices/a105

Un livre de Wikilivres.


Application

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

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h" 
/* ------------------------------------ */
/* ------------------------------------ */
#define  TAB  C3
/* ------------------------------------ */
#define   RU  R3
#define   CU  C1
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{

double u[TAB][RU]={{+2,+2,+6},
	               {+1,+5,+3},
	               {+4,+3,+2}};
double **U[TAB];

double **B    =           i_mR(RU,RU);

double w[RU]  = {+2,+2,+6};
double **W    = ca_A_mR(w,i_mR(RU,C1));

double **BW   =           i_mR(RU,C1);

double **InvB =           i_mR(RU,RU);

int c;

  clrscrn();
  
  for(c=C0; c<TAB; c++)
     {
       U[c] = ca_A_mR( u[c],i_mR(RU,C1));
       c_c_mR(U[c],C1, B,c+C1);
      }
      
  printf(" Three U vectors in the Standard Basis \n\n"  
         "    U[0]   U[1]   U[2] :");	     
  p_mR(B,S6,P0,C10);


  printf(" The W vector in the standard basis : ");      
  p_mR(W,S6,P0,C10);  
  
  printf(" Find the coordinate of W into the U basis");
  mul_mR(inv_mR(B,InvB),W,BW);
  p_mR(BW,S6,P0,C10);
  
  stop();

  for(c=C0; c<TAB; c++)
  
       f_mR(U[c]); 
       
  f_mR(B);   
  f_mR(InvB); 
  f_mR(W); 
  f_mR(BW);  
}
/* ------------------------------------ */
int main(void)
{
  fun();

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


Les coordonnées de W dans la base U.


Exemple de sortie écran :

 ------------------------

 Three U vectors in the Standard Basis 

    U[0]   U[1]   U[2] :
    +2     +1     +4 
    +2     +5     +3 
    +6     +3     +2 

 The W vector in the standard basis : 
    +2 
    +2 
    +6 

 Find the coordinate of W into the U basis
    +1 
    -0 
    +0 

 Press return to continue.