Mathc complexes/a211

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 **VxU_T           = i_mZ(R1, C3);
double **WxU_T           = i_mZ(R1, C3);
double **VxU_T_pls_WxU_T = i_mZ(R1, C3);

double **V_plus_W_T      = add_mZ(V_T,W_T,i_mZ(R1, C3));
double **VplusW_xU_T     =                i_mZ(R1, C3);

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

// (v x u) 
  c_r_mZ(V_T, R1, A, R2);
  c_r_mZ(U_T, R1, A, R3);
  
// cofactor(A) -> (v x u)   
  c_z_mZ(cofactor_Z(A, R1, C1),       VxU_T, R1, C1);
  c_z_mZ(cofactor_Z(A, R1, C2*C2-C1), VxU_T, R1, C2);
  c_z_mZ(cofactor_Z(A, R1, C3*C2-C1), VxU_T, R1, C3);
//                          c*C2    : a number has two columns                              
//                              -C1 : The real part of the number


// (w x u)  
  c_r_mZ(W_T, R1, A, R2);
  c_r_mZ(U_T, R1, A, R3);
  
// cofactor(A) -> (w x u)   
  c_z_mZ(cofactor_Z(A, R1, C1),       WxU_T, R1, C1);
  c_z_mZ(cofactor_Z(A, R1, C2*C2-C1), WxU_T, R1, C2);
  c_z_mZ(cofactor_Z(A, R1, C3*C2-C1), WxU_T, R1, C3);
//                          c*C2    : a number has two columns                              
//                              -C1 : The real part of the number

// (vxu) + (wxu)
  add_mZ(VxU_T,WxU_T,VxU_T_pls_WxU_T);

// (v+w) x u    
  c_r_mZ(V_plus_W_T, R1, A, R2);
  c_r_mZ(U_T       , R1, A, R3);
  
// cofactor(A) -> ((v+w) x u)   
  c_z_mZ(cofactor_Z(A, R1, C1),       VplusW_xU_T, R1, C1);
  c_z_mZ(cofactor_Z(A, R1, C2*C2-C1), VplusW_xU_T, R1, C2);
  c_z_mZ(cofactor_Z(A, R1, C3*C2-C1), VplusW_xU_T, R1, C3);
//                          c*C2    : a number has two columns                              
//                              -C1 : The real part of the number
    
  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("\n\n"
         "    (v+w) x u == (vxu) + (wxu) \n\n"  
         "    (v+w) x u :");    
  p_mZ(VplusW_xU_T, S5, P0, S3, P0, C6);                       
  printf("    (vxu) + (wxu) :");
  p_mZ(VxU_T_pls_WxU_T, S5, P0, S3, P0, C6);
  
  f_mZ(U_T); 
  f_mZ(V_T);
  f_mZ(W_T);  

  f_mZ(VxU_T); 
  f_mZ(WxU_T);
  f_mZ(VxU_T_pls_WxU_T); 

  f_mZ(V_plus_W_T);
  f_mZ(VplusW_xU_T);
       
  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  :
  +9 -3i   +6 +6i   -6 +8i 

  v_T  :
  +6 +5i   -5 -7i   -8 -3i 

  w_T  :
  +7 +1i   -4 -2i   +2 +1i 



    (v+w) x u == (vxu) + (wxu) 

    (v+w) x u :
 +150+30i   +66-68i  +150+168i 

    (vxu) + (wxu) :
 +150+30i   +66-68i  +150+168i 


 Press   return to continue
 Press X return to stop