Aller au contenu

Mathc complexes/a122

Un livre de Wikilivres.

Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void AplsB(int r)
{
double **A  = i_mZ(r,r);
double **B  = i_mZ(r,r);
double **T  = i_mZ(r,r);

  rE_commute2_mZ(A,B,999,1E-4);

  clrscrn();
  printf(" A : ");
  p_mZ(A,S5,P3,S5,P3,C6);                                
  printf(" B : ");
  p_mZ(B,S5,P3,S5,P3,C6);       
  stop();
  
  clrscrn();
  printf(" AB : ");
  p_mZ(mul_mZ(A,B,T),S5,P5,S5,P5,C6);
  printf(" BA : ");
  p_mZ(mul_mZ(B,A,T),S5,P5,S5,P5,C6);
    
  f_mZ(A);
  f_mZ(B);
  f_mZ(T);
}
/* ------------------------------------ */
void hello(void)
{
  
  printf("\n                                                  ");
  printf("\n       Two commutative matrices                   ");
  printf("\n            ****************                    \n");
  printf("\n                                                  ");
  printf("\n                                                  ");
  printf("\n                                                \n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  hello();
do
{
  AplsB(RC3);

} while(stop_w());

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


Exemple de sortie écran :
 A : 
-0.884-0.658i +0.581-0.288i +0.626+0.105i 
+1.097-0.500i +0.144+0.211i -0.071+0.579i 
+0.524-0.907i +1.018-0.155i -0.209+0.447i 

 B : 
-0.683+0.477i -0.691+0.323i +0.535-0.310i 
+0.152-0.063i -0.013-0.291i -0.666+0.067i 
-1.003+0.379i -1.037+0.128i +0.698-0.186i 

 Press return to continue. 


 AB : 
+0.32094+0.07944i +0.06994-0.02464i -0.58888+0.10885i 
-0.62409+0.28137i -0.53781+0.04634i +0.38079-0.32211i 
+0.26002+0.25394i +0.03226+0.01055i -0.73124-0.12578i 

 BA : 
+0.32094+0.07944i +0.06994-0.02464i -0.58888+0.10885i 
-0.62409+0.28137i -0.53781+0.04634i +0.38079-0.32211i 
+0.26002+0.25394i +0.03226+0.01055i -0.73124-0.12578i 


 Press   return to continue
 Press X return to stop