Aller au contenu

Mathc matrices/a157

Un livre de Wikilivres.



Fonctions matricielles ex : cos(A)


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


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

double **Log_EValue = i_mR(RCA,RCA);
double **LogA       = i_mR(RCA,RCA);  

double **V          = i_mR(RCA,RCA);
double **V_T        = i_mR(RCA,RCA);

double **T          = i_mR(RCA,RCA);

   clrscrn();     
   printf(" Copy/Past into the octave window.       \n\n");
   p_Octave_mR(A,"A", P6);
   printf(" logm (A)\n\n\n");
   
      eigs_V_mR(A,V);
   transpose_mR(V,V_T);
    
/* EValue = V_T * A * V        */   
   mul_mR(V_T,A,T);
   mul_mR(T,V,EValue);  
    
   printf(" LogA :");
   f_eigs_mR(log,EValue, Log_EValue);     
      mul_mR(V,Log_EValue,T);
      mul_mR(T,V_T,LogA);
        p_mR(    LogA, S9,P6, C6);
       
   f_mR(A);
   f_mR(EValue);   
       
   f_mR(Log_EValue);
   f_mR(LogA); 
      
   f_mR(V);
   f_mR(V_T);

   f_mR(T);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
    fun();
    
} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
                         Log(A)


Exemple de sortie écran :
 Copy/Past into the octave window.       

 A=[
+1.458481,+0.258525,-0.084543,+0.036790,-0.178966;
+0.258525,+1.441589,+0.054171,-0.094799,-0.755743;
-0.084543,+0.054171,+2.805373,+1.860580,+0.318210;
+0.036790,-0.094799,+1.860580,+1.519039,+0.950474;
-0.178966,-0.755743,+0.318210,+0.950474,+2.211191]

 logm (A)


 LogA :
+0.334180 +0.146498 -0.221020 +0.324416 -0.171834 
+0.146498 +0.214120 -0.098123 +0.262533 -0.546165 
-0.221020 -0.098123 -0.381242 +2.751387 -0.686323 
+0.324416 +0.262533 +2.751387 -2.898790 +1.593099 
-0.171834 -0.546165 -0.686323 +1.593099 +0.208317 


 Press   return to continue
 Press X return to stop