Gauss-Jordan


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


gj_r1.c
/* ------------------------------------ */
/*  Save as :   gj_r1.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A  = i_mR(r,r);
double **b  = i_mR(r,C1);
double **Ab = i_Abr_Ac_bc_mR(r,r,C1);
/*            i_Abr_Ac_bc_mR(R_Ab,C_A,C_b));  */

 do
  {
   r_mR(A,999.);
   printf(".");
  }while(!det_R(A));

  clrscrn();
  printf(" A :");
  p_mR(A,S8,P0,C7);
  
  printf(" b :");
  r_mR(b,999.);
  p_mR(b,S8,P0,C7);
  
  printf(" Ab :");
  c_A_b_Ab_mR(A,b,Ab);
  p_mR(Ab,S8,P0,C7);
  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,C7);

  f_mR(Ab);
  f_mR(b);
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(rp_I(RC5)+R1);


} while(stop_w());

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


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


Exemple de sortie écran :
 ------------------------------------ 
 A :
    -325     -601     -801     -221     +360 
    -855     +832     +226     -815     -233 
    +724     -933      -49     -231     -965 
    +290     +238     -905     +772     -327 
    +636     -519     +662       -7     -375 

 b :
    +524 
    -143 
    -787 
    +446 
    -813 

 Ab :
    -325     -601     -801     -221     +360     +524 
    -855     +832     +226     -815     -233     -143 
    +724     -933      -49     -231     -965     -787 
    +290     +238     -905     +772     -327     +446 
    +636     -519     +662       -7     -375     -813 

 Press return to continue. 




 Copy/Past into the octave window.

 Ab=[
-325,-601,-801,-221,+360,+524;
-855,+832,+226,-815,-233,-143;
+724,-933,-49,-231,-965,-787;
+290,+238,-905,+772,-327,+446;
+636,-519,+662,-7,-375,-813]


 rref(Ab,.00000000001)

  gj_TP_mR(Ab) :
  +1.00000   -0.00000   -0.00000   +0.00000   -0.00000   +2.17421 
  +0.00000   +1.00000   +0.00000   -0.00000   +0.00000   +1.33393 
  +0.00000   +0.00000   +1.00000   -0.00000   +0.00000   -1.37788 
  +0.00000   +0.00000   +0.00000   +1.00000   +0.00000   -1.58506 
  +0.00000   +0.00000   +0.00000   +0.00000   +1.00000   +1.60646 


 Press return to continue
 Press X      to stop