Fonctions matricielles ex : cos(A)


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


c00a.c
/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RCA        RC5
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A             = rEsymmetric_mR(i_mR(RCA,RCA),455.,1E-3);
double **sinh_A         =               i_mR(RCA,RCA);

double **EigsVector    =               i_mR(RCA,RCA);
double **T_EigsVector  =               i_mR(RCA,RCA);

double **EigsValue     =               i_mR(RCA,RCA);
double **sinh_EigsValue =               i_mR(RCA,RCA);

double **T1            =               i_mR(RCA,RCA);
  
  clrscrn();
  printf(" A :");
  p_mR(A,S10,P4,C6); 

/* ================================================================== */
  eigs_V_mR(A,EigsVector); 
  transpose_mR(EigsVector,T_EigsVector);
      
/* EigsValue : T_EigsVector * A * EigsVector */
  mul_mR(T_EigsVector,A,T1);
  mul_mR(T1,EigsVector,EigsValue);     
  
  printf(" sinh(A) :");
  f_eigs_mR(sinh,EigsValue,sinh_EigsValue); 
     mul_mR(EigsVector,sinh_EigsValue,T1);
     mul_mR(T1,T_EigsVector,sinh_A);
       p_mR(sinh_A,S10,P4,C6); 

/* ================================================================== */ 
  eigs_V_mR(sinh_A,EigsVector); 
  transpose_mR(EigsVector,T_EigsVector);  
  
/* EigsValue : T_EigsVector * sinh_A * EigsVector */
  mul_mR(T_EigsVector,sinh_A,T1);
  mul_mR(T1,EigsVector,EigsValue);     
  
  printf(" asinh(sinh(A)) = A :");
  f_eigs_mR(asinh,EigsValue,sinh_EigsValue);  
     mul_mR(EigsVector,sinh_EigsValue,T1);
     mul_mR(T1,T_EigsVector,A); 
       p_mR(A,S10,P4,C6);

  f_mR(A);
  f_mR(sinh_A);

  f_mR(EigsVector);
  f_mR(T_EigsVector);
  
  f_mR(EigsValue);  
  f_mR(sinh_EigsValue);    
      
  f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
  fun();

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
                         asinh(sinh(A)) = A


Exemple de sortie écran :
 ------------------------------------  
 A :
   +0.3540    +0.1024    +0.0561    +0.0159    +0.1117 
   +0.1024    +0.3927    -0.1399    +0.1085    -0.0082 
   +0.0561    -0.1399    +0.7073    +0.2214    +0.0248 
   +0.0159    +0.1085    +0.2214    +0.2599    -0.0655 
   +0.1117    -0.0082    +0.0248    -0.0655    +0.3025 

 sinh(A) :
   +0.3662    +0.1088    +0.0635    +0.0199    +0.1181 
   +0.1088    +0.4107    -0.1575    +0.1094    -0.0084 
   +0.0635    -0.1575    +0.7883    +0.2498    +0.0271 
   +0.0199    +0.1094    +0.2498    +0.2745    -0.0673 
   +0.1181    -0.0084    +0.0271    -0.0673    +0.3098 

 asinh(sinh(A)) = A :
   +0.3540    +0.1024    +0.0561    +0.0159    +0.1117 
   +0.1024    +0.3927    -0.1399    +0.1085    -0.0082 
   +0.0561    -0.1399    +0.7073    +0.2214    +0.0248 
   +0.0159    +0.1085    +0.2214    +0.2599    -0.0655 
   +0.1117    -0.0082    +0.0248    -0.0655    +0.3025 


 Press   return to continue
 Press X return to stop