Aller au contenu

Mathc complexes/a230

Un livre de Wikilivres.


Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"  
/* ------------------------------------ */
/* ------------------------------------ */
#define   RA     R3
#define   CA     C4
#define   Cb     C1
/* ------------------------------------ */
#define   CB     C3          /* B : a basis for the column space of A */
/* ------------------------------------ */
void fun(void)
{
double ab[RA*((CA+Cb)*C2)] ={
 1*1,2*1,  3*1,4*1,  5*1,6*1,  5*1,2*1, 0,0,
 1*3,2*3,  3*3,4*3,  5*3,6*3,  1*3,3*3, 0,0,
 1*4,2*4,  3*4,4*4,  1*4,1*4,  4*4,2*4, 0,0};
                        
double **Ab  =   ca_A_mZ(ab, i_Abr_Ac_bc_mZ(RA,CA,Cb));
double **A   = c_Ab_A_mZ(Ab,           i_mZ(RA,CA));
double **b   = c_Ab_b_mZ(Ab,           i_mZ(RA,Cb));

double **B   =                         i_mZ(RA,CB);
double **BT  =                         i_mZ(CB,RA);
double **BTb =               i_Abr_Ac_bc_mZ(CB,RA,Cb);

  clrscrn();
  printf("Basis for a Column Space by Row Reduction :\n\n");
  printf(" A :");
  p_mZ(A, S3,P0, S3,P0, C8);
  printf(" b :");
  p_mZ(b, S3,P0, S3,P0, C8);
  printf(" Ab :");
  p_mZ(Ab, S3,P0, S3,P0, C8);
  stop();

  clrscrn(); 
  printf(" The leading 1’s of Ab give the position \n"
         " of the columns  of A which form a basis \n"
         " for the column space of A \n\n"
         " A :");
  p_mZ(A, S8,P4, S8,P4, C4);
  printf(" gj_PP_mZ(Ab) :");
  p_mZ(gj_PP_mZ(Ab), S8,P4, S8,P4, C4);
  
  c_c_mZ(A,C1,B,C1);
  c_c_mZ(A,C3,B,C2);
  c_c_mZ(A,C4,B,C3);

  printf(" B :");
  p_mZ(B, S8,P4, S8,P4, C4);
  stop();

  clrscrn();   
  printf(" Check if the columns of B are linearly independent\n\n"
         " BT :");
  p_mZ(transpose_mZ(B,BT), S4,P0, S3,P0, C4);  
  printf(" BTb :");
  p_mZ(c_mZ(BT,BTb), S4,P0, S3,P0, C4); 
  printf(" gj_PP_mZ(BTb) :");
  p_mZ(gj_PP_mZ(BTb), S8,P4, S8,P4, C4); 
        
  stop();   
  
  f_mZ(Ab);
  f_mZ(A);
  f_mZ(b);
  f_mZ(B);
  f_mZ(BT);
  f_mZ(BTb);
  
}
/* ------------------------------------ */
int main(void)
{

  fun();

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


La position des pivots de Ab donne la position des colonnes de A qui forment une base pour l'espace colonnes de A.


Exemple de sortie écran :
Basis for a Column Space by Row Reduction :

 A :
 +1 +2i  +3 +4i  +5 +6i  +5 +2i 
 +3 +6i  +9+12i +15+18i  +3 +9i 
 +4 +8i +12+16i  +4 +4i +16 +8i 

 b :
 +0 +0i 
 +0 +0i 
 +0 +0i 

 Ab :
 +1 +2i  +3 +4i  +5 +6i  +5 +2i  +0 +0i 
 +3 +6i  +9+12i +15+18i  +3 +9i  +0 +0i 
 +4 +8i +12+16i  +4 +4i +16 +8i  +0 +0i 

 Press return to continue.  


 The leading 1s of Ab give the position 
 of the columns  of A which form a basis 
 for the column space of A 

 A :
 +1.0000 +2.0000i  +3.0000 +4.0000i  +5.0000 +6.0000i  +5.0000 +2.0000i 
 +3.0000 +6.0000i  +9.0000+12.0000i +15.0000+18.0000i  +3.0000 +9.0000i 
 +4.0000 +8.0000i +12.0000+16.0000i  +4.0000 +4.0000i +16.0000 +8.0000i 

 gj_PP_mZ(Ab) :
 +1.0000 +0.0000i  +2.2000 -0.4000i  +0.6000 -0.2000i  +1.6000 -1.2000i 
 +0.0000 +0.0000i  -0.0000 +0.0000i  +1.0000 -0.0000i  -0.1707 +0.4634i 
 +0.0000 +0.0000i  +0.0000 +0.0000i  +0.0000 +0.0000i  +1.0000 +0.0000i 

 +0.0000 +0.0000i 
 +0.0000 +0.0000i 
 +0.0000 +0.0000i 

 B :
 +1.0000 +2.0000i  +5.0000 +6.0000i  +5.0000 +2.0000i 
 +3.0000 +6.0000i +15.0000+18.0000i  +3.0000 +9.0000i 
 +4.0000 +8.0000i  +4.0000 +4.0000i +16.0000 +8.0000i 

 Press return to continue. 


 Check if the columns of B are linearly independent

 BT :
  +1 +2i   +3 +6i   +4 +8i 
  +5 +6i  +15+18i   +4 +4i 
  +5 +2i   +3 +9i  +16 +8i 

 BTb :
  +1 +2i   +3 +6i   +4 +8i   +0 +0i 
  +5 +6i  +15+18i   +4 +4i   +0 +0i 
  +5 +2i   +3 +9i  +16 +8i   +0 +0i 

 gj_PP_mZ(BTb) :
 +1.0000 +0.0000i  +3.0000 +0.0000i  +0.7213 -0.0656i  +0.0000 +0.0000i 
 -0.0000 +0.0000i  +1.0000 +0.0000i  -0.8267 -0.7805i  +0.0000 -0.0000i 
 +0.0000 -0.0000i  -0.0000 -0.0000i  +1.0000 +0.0000i  +0.0000 +0.0000i 

 Press return to continue.