Aller au contenu

Mathc matrices/a156

Un livre de Wikilivres.



Fonctions matricielles ex : cos(A)


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


c01b.c
/* ------------------------------------ */
/*  Save as :   c01b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA      RC3
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double a[RCA*RCA]={+1.7568,+0.3975,-0.1827,
                   +0.3975,+1.0008,-0.8822,
                   -0.1827,-0.8822,+1.3684};
                  	
double **A          = ca_A_mR(a,i_mR(RCA,RCA));
double **EValue     =           i_mR(RCA,RCA); 

double **Exp_EValue =           i_mR(RCA,RCA);
double **ExpA       =           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(" expm (A)\n\n\n");

/* EVector                     */    
      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);  

/* expm(EValue)                 */   
   f_eigs_mR(exp,EValue, Exp_EValue);

/* A = V * A_EValue * V_T */     
   mul_mR(V,Exp_EValue,T);
   mul_mR(T,V_T,ExpA); 
       
   printf(" ExpA :");
   p_mR(    ExpA, S11,P6, C6);
   
   stop();
       
   f_mR(A);
   f_mR(EValue);   
       
   f_mR(Exp_EValue);
   f_mR(ExpA); 
      
   f_mR(V);
   f_mR(V_T);

   f_mR(T);
   
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
                         Exp(A)


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

 A=[
+1.756800,+0.397500,-0.182700;
+0.397500,+1.000800,-0.882200;
-0.182700,-0.882200,+1.368400]

 expm (A)


 ExpA :
  +6.372503   +2.224700   -1.766128 
  +2.224700   +4.415838   -3.579522 
  -1.766128   -3.579522   +5.572321 


 Press   return to continue