Aller au contenu

Mathc matrices/a108

Un livre de Wikilivres.


Application


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


gj_r2.c
/* ------------------------------------ */
/*  Save as :   gj_r2.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RA R3
#define   CA C3
#define   Cb C5
/* ------------------------------------ */
int main(void)
{
double at[RA*CA]={
     +10,     -150,     -148, 
    +207,     -215,     +997, 
    -858,     +803,     +289  
};

double bt[RA*Cb]={
    +437,     -146,     -175,     -954,     -432, 
    -233,     +243,     +772,     +920,      -98, 
    +444,     -886,     -604,      -15,     +946  
};

double **A  = ca_A_mR(at,i_mR(RA,CA));
double **b  = ca_A_mR(bt,i_mR(RA,Cb));

double **Ab = i_Abr_Ac_bc_mR(RA,CA,Cb);

  clrscrn();
  printf(" A :");
  p_mR(A,S8,P0,C6);

  printf("       b1       b2      ...      bn :\n");
  p_mR(b,S8,P0,C6);
  stop();
  
  clrscrn();  
  printf(" Ab :");
  c_A_b_Ab_mR(A,b,Ab);
  p_mR(Ab,S8,P0,C6);
  stop();

  clrscrn();
  printf(" Copy/Past into the octave window.\n\n");
  p_Octave_mR(Ab,"Ab",P0);
  printf("\n rref(Ab,.00000000001)\n\n");
  printf("  gj_TP_mR(Ab) :");
  gj_TP_mR(Ab);
  p_mR(Ab,S10,P4,C6);
  stop();
  
  f_mR(Ab);
  f_mR(b);
  f_mR(A);
  
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


Nous utilisons la fonction gj_TP_mR(Ab); pour résoudre ce système.


Exemple de sortie écran :
 ------------------------------------ 
 A :
     +10     -150     -148 
    +207     -215     +997 
    -858     +803     +289 

       b1       b2      ...      bn :

    +437     -146     -175     -954     -432 
    -233     +243     +772     +920      -98 
    +444     -886     -604      -15     +946 

 Press return to continue. 

 ------------------------------------ 
 Ab :
     +10     -150     -148     +437     -146     -175 
    +207     -215     +997     -233     +243     +772 
    -858     +803     +289     +444     -886     -604 

    -954     -432 
    +920      -98 
     -15     +946 

 Press return to continue. 


 ------------------------------------ 
 Copy/Past into the octave window.

 Ab=[
+10,-150,-148,+437,-146,-175,-954,-432;
+207,-215,+997,-233,+243,+772,+920,-98;
-858,+803,+289,+444,-886,-604,-15,+946]


 rref(Ab,.00000000001)

  gj_TP_mR(Ab) :
   +1.0000    +0.0000    -0.0000    -3.3492    +2.0425    +1.5396 
   -0.0000    +1.0000    -0.0000    -2.9619    +1.0616    +0.6767 
   +0.0000    +0.0000    +1.0000    -0.1771    +0.0486    +0.6006 

   +5.7575    +1.5874 
   +5.7825    +2.8101 
   +0.9744    +0.1781 

 Press return to continue.