Mathc matrices/a242

Un livre de Wikilivres.



Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(void)
{
double **W_T =    r_mR(i_mR(R1, C3), 9);	 
double **U_T =    r_mR(i_mR(R1, C3), 9);  
double **V_T =    r_mR(i_mR(R1, C3), 9);  

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

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

double **W = transpose_mR(W_T,  i_mR(R3 , C1));
double **U = transpose_mR(U_T,  i_mR(R3 , C1));
double **V = transpose_mR(V_T,  i_mR(R3 , C1));

  c_r_mR(W_T, R1, A, R1);
  c_r_mR(U_T, R1, A, R2);
  c_r_mR(V_T, R1, A, R3);
  
  c_s_mR(cofactor_R(A, R1, C1), UxV_T, R1, C1);
  c_s_mR(cofactor_R(A, R1, C2), UxV_T, R1, C2);
  c_s_mR(cofactor_R(A, R1, C3), UxV_T, R1, C3);
  
  transpose_mR(UxV_T, UxV);
      
  clrscrn(); 
  printf("  w_t  :");
  p_mR(W_T, S4, P0, C6);      
  printf("  u_t  :");
  p_mR(U_T, S4, P0, C6);
  printf("  v_t  :");
  p_mR(V_T, S4, P0, C6);
  printf("  uxv_t :");
  p_mR(UxV_T, S4, P0, C6);

  printf("                  |  1  1  1 |    | w1 w2 w3 |            \n"  
         "  w.(u x v) == w. | u1 u2 u3 | == | u1 u2 u3 |  == det(A) \n"
         "                  | v1 v2 v3 |    | v1 v2 v3 |          \n\n"
         "  w.(u x v) == %+.4f                 det(A)     == %+.4f\n\n", 
  
                        dot_R(W, UxV),                    det_R(A) ); 
                        
                                                  
  f_mR(W_T);
  f_mR(U_T); 
  f_mR(V_T);
  f_mR(U); 
  f_mR(V);
  
  f_mR(UxV_T);
  f_mR(UxV);   

  f_mR(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 :
 --------------------
  w_t  :
  +8   -5   +4 

  u_t  :
  -4   +2   -2 

  v_t  :
  +5   +9   +2 

  uxv_t :
 +22   -2  -46 

                  |  1  1  1 |    | w1 w2 w3 |            
  w.(u x v) == w. | u1 u2 u3 | == | u1 u2 u3 |  == det(A) 
                  | v1 v2 v3 |    | v1 v2 v3 |          

  w.(u x v) == +2.0000                 det(A)     == +2.0000


 Press   return to continue
 Press X return to stop