Aller au contenu

Mathc complexes/a141

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"
/* ------------------------------------ */
void fun(int r)
{
double **A   = i_mZ(r,r);
double **A_2 = i_mZ(r,r);
double **B   = i_mZ(r,r);
double **B_2 = i_mZ(r,r);
double **AplsB   = i_mZ(r,r);
double **AplsB_2 = i_mZ(r,r);
double **AB   = i_mZ(r,r);
double **AB2  = i_mZ(r,r);
double **T1   = i_mZ(r,r);
double **T2   = 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(" (A+B)**2 :\n");
  add_mZ(A,B,AplsB);
  pow_mZ(2,AplsB,AplsB_2);
  p_mZ(AplsB_2,S8,P3,S8,P3,C6);  
      
  printf(" A**2 + 2*AB + B**2  :\n");
  pow_mZ(2,A,A_2);  
  mul_mZ(A,B,AB);
 smul_mZ(2,AB,AB2);
  pow_mZ(2,B,B_2);
  add_mZ(A_2,AB2,T1);
  add_mZ(T1,B_2,T2);
  p_mZ(T2,S8,P3,S8,P3,C6);
    
  f_mZ(A);
  f_mZ(A_2);
  f_mZ(B);
  f_mZ(B_2);
  f_mZ(AplsB);
  f_mZ(AplsB_2);
  f_mZ(AB);
  f_mZ(AB2);
  f_mZ(T1);
  f_mZ(T2);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n                                                  ");
  printf("\n            Commutative matrices                  ");
  printf("\n                                                  ");
  printf("\n       (A+B)**2 = A** + 2*AB + B**2                ");
  printf("\n          **********************                \n");
  printf("\n\n                                                ");
  printf("\n                                                \n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  hello();
do
{
  fun(RC4);

} while(stop_w());

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


Propriétés des matrices commutatives :


Exemple de sortie écran :

 -------------------------------------------
 A : 
+1.966+0.980i -1.861-0.827i +1.394-0.267i -1.376-1.423i 
+0.924+2.426i -1.247-2.326i +1.733+1.197i -0.339-2.241i 
-0.465+0.329i -0.215-0.400i +0.390-0.075i -0.236+0.212i 
+0.008-1.084i -0.068+1.529i -0.915-1.420i -0.286+1.421i 

 B : 
+1.803+0.323i -2.499-0.091i +1.607-1.307i -1.985-0.587i 
+1.219+2.963i -2.282-2.942i +2.620+1.297i -0.814-2.650i 
+0.131+1.611i -0.664-1.702i +0.821+0.693i -0.471-1.131i 
+0.828-1.908i -0.786+2.311i -0.859-2.291i -1.556+1.927i 

 Press return to continue. 


 -------------------------------------------
 (A+B)**2 :

  +1.339  -0.929i   -0.036  +0.958i   -0.226  -0.910i   -0.158  +1.237i 
  -0.003  -0.235i   +1.496  +0.129i   +0.312  -0.272i   -0.349  +0.300i 
  +0.713  +1.123i   -0.362  -1.121i   +2.392  +0.756i   -0.151  -1.348i 
  +0.781  -0.453i   -0.665  +0.275i   +0.335  -0.394i   +0.977  +0.045i 

 A**2 + 2*AB + B**2  :

  +1.339  -0.929i   -0.036  +0.958i   -0.226  -0.910i   -0.158  +1.237i 
  -0.003  -0.235i   +1.496  +0.129i   +0.312  -0.272i   -0.349  +0.300i 
  +0.713  +1.123i   -0.362  -1.121i   +2.392  +0.756i   -0.151  -1.348i 
  +0.781  -0.453i   -0.665  +0.275i   +0.335  -0.394i   +0.977  +0.045i 


 Press return to continue
 Press X      to stop