Mathc complexes/a181

Un livre de Wikilivres.

Application


Installer et compiler ce fichier dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h" 
/* ------------------------------------ */
/* ------------------------------------ */
#define  TAB  C3
#define   RA  R3
#define   CA  C1
#define   CB  RA+C1
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A[TAB];
double **T[TAB];
nb_Z     z[TAB];

double **B  =        i_mZ(RA,CB);
double **ID = eye_mZ(i_mZ(RA,RA));
int c;
   
  clrscrn();
                
  for(c=C0; c<TAB; c++)
     {
      T[c] = i_mZ(RA,CA);
      
      c_c_mZ(ID,c+C1, T[c],C1); 
      c_c_mZ(T[c],C1, B,c+C1);
     }
  
  printf(" The Three Standard Columns Vectors \n\n"  
         "   A[0]     A[1]     A[2] :");	     
  p_mZ(B,S4,P0,S3,P0,C10);
  
  stop();

  clrscrn();

  for(c=C0; c<TAB; c++)
     {
	  A[c] = i_mZ(RA,CA);	 
      z[c] = r_Z(9);

      zmul_mZ(z[c],T[c],A[c]);
      c_c_mZ(A[c],C1, B,c+C1);
     } 
     
  add_mZ(A[0],A[1],T[0]); 
  add_mZ(T[0],A[2],T[1]); 
  c_c_mZ(T[1],C1, B,CB);
   
  printf(" V is a linear combination of    \n"  
         " the three Standard Columns Vectors of R_3 :\n\n"
         "    z0*A[0]    z1*A[1]    z2*A[2]  =  V ");	     
  p_mZ(B,S6,P0,S3,P0,C10);

  for(c=C0; c<TAB; c++)
     {
       f_mZ(A[c]); 
       f_mZ(T[c]);        
     }   
       
  f_mZ(B);
  f_mZ(ID);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

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


L'affichage des vecteurs d'une colonne prend trop de place. J'ai donc tenté de les installer dans une matrice avant de les afficher.


Exemple de sortie écran :

 -------------------------------
 The Three Standard Columns Vectors 

   A[0]     A[1]     A[2] :
  +1 +0i   +0 +0i   +0 +0i   +0 +0i 
  +0 +0i   +1 +0i   +0 +0i   +0 +0i 
  +0 +0i   +0 +0i   +1 +0i   +0 +0i 

 Press return to continue. 


 -------------------------------
 V is a linear combination of    
 the three Standard Columns Vectors of R_3 :

    z0*A[0]    z1*A[1]    z2*A[2]  =  V 
    +8 -6i     -0 +0i     +0 +0i     +8 -6i 
    +0 +0i     -8 +6i     +0 +0i     -8 +6i 
    +0 +0i     -0 +0i     +4 -5i     +4 -5i 


 Press   return to continue
 Press X return to stop