Aller au contenu

Mathc complexes/a135

Un livre de Wikilivres.


Application


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

c00b.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);

  r_commute2_mZ(A,B,9);

  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,P9,S5,P9,C6);
  printf(" BA : ");
  p_mZ(mul_mZ(B,A,T),S5,P9,S5,P9,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.021-0.058i -0.167+0.579i +0.291-0.035i 
-0.521-0.108i +0.819+0.311i +0.166+0.004i 
+0.359+0.889i +0.606-0.101i +0.798-0.252i 

 B : 
+0.796+0.032i +0.091-0.316i -0.159+0.019i 
+0.284+0.059i +0.360-0.170i -0.091-0.002i 
-0.196-0.485i -0.331+0.055i +0.371+0.138i 

 Press return to continue. 


 ---------------------------------------
 AB : 
-0.137204867-0.025416958i -0.072911473+0.252462463i +0.127060202-0.015377914i 
-0.227127280-0.046970730i +0.210983133+0.135546061i +0.072383946+0.001553184i 
+0.156671185+0.387661650i +0.264346514-0.044004928i +0.201956386-0.110129104i 

 BA : 
-0.137204867-0.025416958i -0.072911473+0.252462463i +0.127060202-0.015377914i 
-0.227127280-0.046970730i +0.210983133+0.135546061i +0.072383946+0.001553184i 
+0.156671185+0.387661650i +0.264346514-0.044004928i +0.201956386-0.110129104i 


 Press return to continue
 Press X      to stop