Mathc complexes/a219

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(void)
{ 
double **U_T =    r_mZ(i_mZ(R1, C3), 9);  
double **V_T =    r_mZ(i_mZ(R1, C3), 9);  
double **W_T =    r_mZ(i_mZ(R1, C3), 9); 

double **UxV_T = i_mZ(R1, C3);
double **UxV   = i_mZ(R3, C1); 

double **A     = i_mZ(R3, C3) ;

double **W = transpose_mZ(W_T,  i_mZ(R3 , C1));

  c_r_mZ(W_T, R1, A, R1);
  c_r_mZ(U_T, R1, A, R2);
  c_r_mZ(V_T, R1, A, R3);

  UxV_mZ(U_T,V_T,UxV_T);
      
  ctranspose_mZ(UxV_T, UxV);
      
  clrscrn();       
  printf("  u_t  :");
  p_mZ(U_T, S4, P0, S3, P0, C6);
  printf("  v_t  :");
  p_mZ(V_T, S4, P0, S3, P0, C6);
  printf("  w_t  :");
  p_mZ(W_T, S4, P0, S3, P0, C6);
  printf("  uxv_t :");
  p_mZ(UxV_T, S4, P0, S3, P0, C6);
  
  printf(" w.(u x v) == "); p_Z(dotuv_Z(W, UxV),S3,P0, S3,P0); printf("\n");                  
  printf(" det(A)    == "); p_Z(det_Z(A),S3,P0, S3,P0); printf("\n"); 
                    
  f_mZ(U_T); 
  f_mZ(V_T);
  f_mZ(UxV_T);
      
  f_mZ(UxV);   

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

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

} while(stop_w());

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


Les vecteurs en mathématiques sont supposés être des vecteurs colonnes, c'est pour cela que j'utilise _T pour afficher des vecteurs lignes.


Exemple de sortie écran :

  u_t  :
  -2 +2i   +9 +3i   -2 -1i 

  v_t  :
  +8 -8i   -8 -8i   -1 +5i 

  w_t  :
  -4 +5i   +2 -4i   +6 +9i 

  uxv_t :
 -32+18i  -16+20i  -64+48i 

 w.(u x v) == -730-416i 
 det(A)    == -730-416i 

 Press   return to continue
 Press X return to stop