Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A =       i_mZ(r,r);
double **b = r_mZ( i_mZ(r,C3),999.);
double **X =       i_mZ(r,C3);

double **Ab =      i_Abr_Ac_bc_mZ(r,r,C3);

 do
  {
   r_mZ(A,999.);
   printf(".");
  }while(!det_Z(A).r);

  c_A_b_Ab_mZ(A,b,Ab);

  clrscrn();
  printf("                                                 \n");
  printf(" Linear systems with common coefficient matrix.\n\n");
  printf("                Ax1=b1                           \n");
  printf("                Ax2=b2                           \n");
  printf("                ...                              \n");
  printf("                Axn=bn                         \n\n");
  printf(" We can write these equalities in this maner.  \n\n");
  printf("    A|x1|x2|...|xn| = b1|b2|...|bn|            \n\n");
  printf("  or simply :                                  \n\n");
  printf("              AX = b                           \n\n");
  printf("  where b = b1|b2|...|bn                       \n\n");
  printf("  and   X = x1|x2|...|xn                       \n\n");
  stop();

  clrscrn();
  printf(" We want to find X such as,   \n\n");
  printf("         AX = b               \n\n");
  printf(" We can use the function,       \n");
  printf("   gaussjordan : gj_mZ(Ab);   \n\n");
  printf(" To verify the result you can   \n");
  printf(" multiply the matrix A by X.    \n");
  printf(" You must refind b.         \n\n\n");
  stop();

  clrscrn();
  printf(" A :\n");
  p_mZ(A, S5,P0, S4,P0, C6);
  printf(" b1      b2      ...      bn :\n");
  p_mZ(b, S5,P0, S4,P0, C6);
  stop();

  clrscrn();
  printf(" gj_mZ(Ab) :");
  p_mZ(gj_mZ(Ab), S1,P4, S1,P4, C3);
  stop();

  clrscrn();
  printf(" Ab :");
  p_mZ(Ab, S4,P3, S4,P3, C4);
  printf(" X  :");
  p_mZ(c_Ab_b_mZ(Ab,X), S4,P3, S4,P3, C4);
  stop();

  clrscrn();
  printf(" b1      b2      ...      bn :\n");
  p_mZ(b, S5,P0, S4,P0, C6);
  printf(" Ax1     Ax2     ...      Axn :\n");
  p_mZ(mul_mZ(A,X,b), S5,P0, S4,P0, C6);

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

  srand(time(&t));
do
{
  fun(rp_I(R3)+R2);

} while(stop_w());

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



Exemple de sortie écran :
 ------------------------------------                                                  
 Linear systems with common coefficient matrix.

                Ax1=b1                           
                Ax2=b2                           
                ...                              
                Axn=bn                         

 We can write these equalities in this maner.  

    A|x1|x2|...|xn| = b1|b2|...|bn|            

  or simply :                                  

              AX = b                           

  where b = b1|b2|...|bn                       

  and   X = x1|x2|...|xn                       

 Press return to continue. 


 ------------------------------------ 
 We want to find X such as,   

         AX = b               

 We can use the function,       
   gaussjordan : gj_mZ(Ab);   

 To verify the result you can   
 multiply the matrix A by X.    
 You must refind b.         


 Press return to continue. 


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

+788+830i -311 -59i +406+650i +624+396i -185-871i 
-359-637i -459-189i -263+990i -515-769i +136+294i 
 -99-673i +188-805i +566  +2i -661+702i -827+286i 
-301-615i -117+612i -673-241i +980 +16i +636-883i 
-605-713i -521 -65i -901-783i -773+416i -271-627i 

 b1      b2      ...      bn :

+206+712i +552+856i -339+566i 
+272-535i -247-245i +734-869i 
+830+906i -531-607i -507+146i 
 -61+610i -819+894i +988+174i 
 -95+856i -137+108i +906+880i 

 Press return to continue. 


 ------------------------------------ 
 gj_mZ(Ab) :
+1.000-0.000i -0.000+0.000i -0.000-0.000i -0.000-0.000i 
+0.000+0.000i +1.000+0.000i +0.000-0.000i -0.000-0.000i 
-0.000-0.000i +0.000+0.000i +1.000-0.000i +0.000-0.000i 
+0.000-0.000i +0.000-0.000i +0.000-0.000i +1.000+0.000i 
+0.000+0.000i +0.000-0.000i +0.000-0.000i +0.000-0.000i 

-0.000-0.000i -0.425+0.250i +0.366-0.670i +0.090+0.486i 
-0.000+0.000i -0.313+0.432i -0.339-0.345i -0.517-0.528i 
+0.000-0.000i +0.147-0.204i -0.074+0.240i -0.722-0.158i 
-0.000+0.000i +0.696-0.021i -0.217+0.570i +0.179+0.110i 
+1.000-0.000i -0.776-0.176i -0.735+0.038i -0.334-0.087i 

 Press return to continue. 


 ------------------------------------ 
 gj_mZ(Ab) :
+1.000-0.000i -0.000+0.000i -0.000-0.000i -0.000-0.000i 
+0.000+0.000i +1.000+0.000i +0.000-0.000i -0.000-0.000i 
-0.000-0.000i +0.000+0.000i +1.000-0.000i +0.000-0.000i 
+0.000-0.000i +0.000-0.000i +0.000-0.000i +1.000+0.000i 
+0.000+0.000i +0.000-0.000i +0.000-0.000i +0.000-0.000i 

-0.000-0.000i -0.425+0.250i +0.366-0.670i +0.090+0.486i 
-0.000+0.000i -0.313+0.432i -0.339-0.345i -0.517-0.528i 
+0.000-0.000i +0.147-0.204i -0.074+0.240i -0.722-0.158i 
-0.000+0.000i +0.696-0.021i -0.217+0.570i +0.179+0.110i 
+1.000-0.000i -0.776-0.176i -0.735+0.038i -0.334-0.087i 

 X  :
-0.425+0.250i +0.366-0.670i +0.090+0.486i 
-0.313+0.432i -0.339-0.345i -0.517-0.528i 
+0.147-0.204i -0.074+0.240i -0.722-0.158i 
+0.696-0.021i -0.217+0.570i +0.179+0.110i 
-0.776-0.176i -0.735+0.038i -0.334-0.087i 

 Press return to continue. 


 ------------------------------------ 
 b1      b2      ...      bn :

+206+712i +552+856i -339+566i 
+272-535i -247-245i +734-869i 
+830+906i -531-607i -507+146i 
 -61+610i -819+894i +988+174i 
 -95+856i -137+108i +906+880i 

 Ax1     Ax2     ...      Axn :

+206+712i +552+856i -339+566i 
+272-535i -247-245i +734-869i 
+830+906i -531-607i -507+146i 
 -61+610i -819+894i +988+174i 
 -95+856i -137+108i +906+880i 


 Press return to continue
 Press X      to stop