Application


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


c01a.c
/* ------------------------------------ */
/*  Save as :   c01a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define    RA            R3
#define    CA            C3
#define    Cb            C1
/* ------------------------------------ */
int main(void)
{
double a[RA*CA] ={ 4,2,3,
                   5,3,1,
                   8,2,2};
                   
double b[RA*Cb] ={ 3,
                   2,
                   1};  
                                         
double **A   = ca_A_mR(a,i_mR(RA,CA));
double **B   = ca_A_mR(b,i_mR(RA,Cb));	
	
double **Inv =           i_mR(RA,CA);

double **X   =           i_mR(RA,Cb);
double **T   =           i_mR(RA,Cb);

  clrscrn();
  printf(" We want to find X such as,   \n\n");
  printf("         AX = B               \n\n");
  printf(" If A is a square matrix and, \n\n");
  printf(" If A has an inverse matrix,  \n\n");
  printf(" you can find X by this method\n\n");
  printf("         X = inv(A) B       \n\n\n");
  printf(" To verify the result you can \n\n");
  printf(" multiply the matrix A by X.  \n\n");
  printf(" You must refind B.  \n\n");
  getchar();

  clrscrn();
  printf(" A :\n");
  p_mR(A,S5,P0,C7);
  printf(" B :\n");
  p_mR(B,S5,P0,C7);
  getchar();

  clrscrn();
  printf(" inv(A) :\n");
  pE_mR(inv_mR(A,Inv),S1,P3,C7);
  printf(" X = inv(A) * B :\n");
  p_mR(mul_mR(Inv,B,X),S13,P4,C7);
  getchar();

  clrscrn();
  printf(" B :\n");
  p_mR(B,S5,P0,C7);
  printf("  AX :\n");
  p_mR(mul_mR(A,X,T),S5,P0,C7);
  

  f_mR(T);
  f_mR(X);
  f_mR(B);
  f_mR(Inv);
  f_mR(A);

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




Exemple de sortie écran :
 --------------------------------------
 We want to find X such as,   

         AX = B               

 If A is a square matrix and, 

 If A has an inverse matrix,  

 you can find X by this method

         X = inv(A) B       


 To verify the result you can 

 multiply the matrix A by X.  

 You must refind B.  

 --------------------------------------
 A :

   +4    +2    +3 
   +5    +3    +1 
   +8    +2    +2 

 B :

   +3 
   +2 
   +1 

 --------------------------------------
 inv(A) :

-1.333e-01 -6.667e-02 +2.333e-01 
+6.667e-02 +5.333e-01 -3.667e-01 
+4.667e-01 -2.667e-01 -6.667e-02 

 X = inv(A) * B :

      -0.3000 
      +0.9000 
      +0.8000 


 --------------------------------------
 B :

   +3 
   +2 
   +1 

  AX :

   +3 
   +2 
   +1 

 Press return to continue.