Aller au contenu

Mathc matrices/c15b

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"
/* ------------------------------------ */
void fun(int r)
{
double **A  = i_mR(r,r);
double **b  = i_mR(r,C5);
double **Ab = i_Abr_Ac_bc_mR(r,r,C5);
/*            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,C6);

  printf("       b1       b2      ...      bn :\n");
  r_mR(b,999.);
  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);

  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 :
    +788     -473     -703     +478     -281 
    +412     +754     +344     -377     -297 
    -515     -621     -443     +388     -755 
      +2     -359     -789     +882     +958 
    -551     +376     +138     +280     -117 

       b1       b2      ...      bn :

    -147     -895     -377     -363     -199 
    +934     +152     +390     +356     +348 
    -389     +486     +820     -733     -863 
    -117     +966     +484     -559     +354 
    -957     +560     -431     +746     +162 

 Press return to continue. 



 Ab :
    +788     -473     -703     +478     -281     -147 
    +412     +754     +344     -377     -297     +934 
    -515     -621     -443     +388     -755     -389 
      +2     -359     -789     +882     +958     -117 
    -551     +376     +138     +280     -117     -957 

    -895     -377     -363     -199 
    +152     +390     +356     +348 
    +486     +820     -733     -863 
    +966     +484     -559     +354 
    +560     -431     +746     +162 

 Press return to continue. 



 Copy/Past into the octave window.

 Ab=[
+788,-473,-703,+478,-281,-147,-895,-377,-363,-199;
+412,+754,+344,-377,-297,+934,+152,+390,+356,+348;
-515,-621,-443,+388,-755,-389,+486,+820,-733,-863;
+2,-359,-789,+882,+958,-117,+966,+484,-559,+354;
-551,+376,+138,+280,-117,-957,+560,-431,+746,+162]


 rref(Ab,.00000000001)

  gj_TP_mR(Ab) :
  +1.00000   -0.00000   +0.00000   +0.00000   +0.00000   -1.10815 
  +0.00000   +1.00000   +0.00000   +0.00000   -0.00000   +2.22788 
  -0.00000   -0.00000   +1.00000   -0.00000   +0.00000   -6.30681 
  +0.00000   +0.00000   +0.00000   +1.00000   +0.00000   -5.31055 
  +0.00000   -0.00000   +0.00000   +0.00000   +1.00000   +0.41008 

  -2.37746   -2.59443   +1.06347   +0.34143 
  +2.55587   +2.83566   -0.54926   +0.50154 
  -5.47986   -8.54634   +4.37136   +0.49836 
  -3.22963   -6.15601   +3.25975   +0.53116 
  +0.43136   +0.20223   -0.19249   +0.47818 


 Press return to continue
 Press X      to stop