Mathc matrices/c17e

Un livre de Wikilivres.
Aller à la navigation Aller à la recherche


Sommaire


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


Crystal Clear mimetype source c.png gj_r5.c
/* ------------------------------------ */
/*  Save as :   gj_r5.c                 */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
void fun(int r, int c)
{
double **A  = i_mR(r,c);
double **b  = i_mR(r,C1);
double **Ab = i_Abr_Ac_bc_mR(r,c,C1);

double **new_Ab = i_Abr_Ac_bc_mR(csize_A_R(Ab), 
                                 csize_A_R(Ab),
                                 csize_R(A)-rsize_R(A) + C1);  
            
double **new_b  = i_mR(rsize_R(new_Ab),csize_b_R(new_Ab));          
                        

  r_mR(A,999.);
  r_mR(b,999.);
  
  clrscrn();
  printf(" A :");
  p_mR(A,S8,P0,C7);
  
  printf(" b :");
  p_mR(b,S8,P0,C7);
  
  printf(" Ab :");
  c_A_b_Ab_mR(A,b,Ab);
  p_mR(Ab,S8,P0,C7);
  stop();

  clrscrn();
  GJ_TP_mR(Ab);
  printf(" Ab :");
  p_mR(Ab,S10,P4,C7);
  stop();  
  
  clrscrn();
  GJ_TPfreeV_mR(Ab,new_Ab); 
  printf(" new_Ab :"); 
  p_mR(new_Ab,S10,P4,C7);
  stop();  
  
  clrscrn();
  c_Ab_b_mR(new_Ab,new_b);
  printf(" new_b :"); 
  p_mR(new_b,S10,P4,C7);
  printf(" new_b : free variables");
  p_freeV(new_b,S8,P4);
  
  f_mR(new_Ab);  
  f_mR(Ab);
  f_mR(b);
  f_mR(A);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
do
{
  fun(rp_I(R3)+R1, rp_I(R3)+R4);


} while(stop_w());

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


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


Exemple de sortie écran :
 A :
    +364     -603     -189     +278     +352     -171     -967 
     -53     -327     +574     -297     -685     -309     +454 
    -391     +322     +730      -13     +312     +156     -693 

 b :
    +318 
    -239 
    -983 

 Ab :
    +364     -603     -189     +278     +352     -171     -967 
     -53     -327     +574     -297     -685     -309     +454 
    -391     +322     +730      -13     +312     +156     -693 

    +318 
    -239 
    -983 

 Press return to continue. 



 Ab :
   +1.0000    +0.0000    +0.0000   +15.2366   +36.2941    +7.3390   -58.5139 
   +0.0000    +1.0000    +0.0000    +7.1764   +17.5204    +3.9626   -27.3832 
   +0.0000    +0.0000    +1.0000    +4.9777   +12.1390    +2.3967   -20.2117 

  -11.8890 
   -6.1342 
   -5.0087 

 Press return to continue. 



 new_Ab :
   +1.0000    +0.0000    +0.0000    +0.0000    +0.0000    +0.0000    +0.0000 
   +0.0000    +1.0000    +0.0000    +0.0000    +0.0000    +0.0000    +0.0000 
   +0.0000    +0.0000    +1.0000    +0.0000    +0.0000    +0.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +1.0000    +0.0000    +0.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +0.0000    +1.0000    +0.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +0.0000    +0.0000    +1.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +0.0000    +0.0000    +0.0000    +1.0000 

  -11.8890   -15.2366   -36.2941    -7.3390   +58.5139 
   -6.1342    -7.1764   -17.5204    -3.9626   +27.3832 
   -5.0087    -4.9777   -12.1390    -2.3967   +20.2117 
   +0.0000    +1.0000    +0.0000    +0.0000    +0.0000 
   +0.0000    +0.0000    +1.0000    +0.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +1.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +0.0000    +1.0000 

 Press return to continue. 



 new_b :
  -11.8890   -15.2366   -36.2941    -7.3390   +58.5139 
   -6.1342    -7.1764   -17.5204    -3.9626   +27.3832 
   -5.0087    -4.9777   -12.1390    -2.3967   +20.2117 
   +0.0000    +1.0000    +0.0000    +0.0000    +0.0000 
   +0.0000    +0.0000    +1.0000    +0.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +1.0000    +0.0000 
   +0.0000    +0.0000    +0.0000    +0.0000    +1.0000 

 new_b : free variables
 x1 =  -11.8890 -15.2366*r -36.2941*s  -7.3390*t +58.5139*u
 x2 =   -6.1342  -7.1764*r -17.5204*s  -3.9626*t +27.3832*u
 x3 =   -5.0087  -4.9777*r -12.1390*s  -2.3967*t +20.2117*u
 x4 =   +0.0000  +1.0000*r  +0.0000*s  +0.0000*t  +0.0000*u
 x5 =   +0.0000  +0.0000*r  +1.0000*s  +0.0000*t  +0.0000*u
 x6 =   +0.0000  +0.0000*r  +0.0000*s  +1.0000*t  +0.0000*u
 x7 =   +0.0000  +0.0000*r  +0.0000*s  +0.0000*t  +1.0000*u

 Press return to continue
 Press X      to stop