Application


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


c00a.c
/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RCA        RC4
/* ------------------------------------ */
void fun(void)
{
int n = 10; 
int i =  0; 

double **A   = rE_mR(i_mR(RCA,RCA),999,+1.E-3); 
double **A_n =       i_mR(RCA,RCA);
double **sA  =       i_mR(RCA,RCA);

double **ExpA      = i_mR(RCA,RCA);   
double **NewExpA   = i_mR(RCA,RCA);   
       
   clrscrn();   
   printf(" Copy/Past into the octave window.       \n\n");
   p_Octave_mR(A, "A", P3);
   printf(" expm (A)\n\n");
   stop();  
   
   clrscrn();    
   printf(" A :");
   p_mR(A,S4,P4,C6);
  
  for(i = 0; i <= n; i++)
   {
     pow_mR(i, A, A_n);    
    smul_mR(1./factorial(i), A_n, sA);    
     add_mR(ExpA,sA,NewExpA);
     
     printf(" NewExpA   n = %d :",i);
     p_mR(NewExpA,S8,P6,C6);       
     c_mR(NewExpA,ExpA);
     stop();
   }

  clrscrn();    
  printf(" ExpA :");
  p_mR(ExpA,S8,P6,C6);

  f_mR(A);
  f_mR(A_n);
  f_mR(sA);
  f_mR(ExpA);
  f_mR(NewExpA);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
    ExpA = Ide + A + (1/2) A**2 + (1/6) A**3 + ... + 1/(n-1)! A**(n-1)

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

 A=[
-0.580,-0.577,-0.752,-0.562;
+0.179,-0.617,-0.719,-0.452;
-0.625,+0.309,-0.478,+0.061;
+0.701,-0.277,+0.500,+0.474]

 expm (A)

 Press return to continue. 


/* ------------------------------------ */
 A :
-0.5800 -0.5770 -0.7520 -0.5620 
+0.1790 -0.6170 -0.7190 -0.4520 
-0.6250 +0.3090 -0.4780 +0.0610 
+0.7010 -0.2770 +0.5000 +0.4740 

 NewExpA   n = 0 :
+1.000000 +0.000000 +0.000000 +0.000000 
+0.000000 +1.000000 +0.000000 +0.000000 
+0.000000 +0.000000 +1.000000 +0.000000 
+0.000000 +0.000000 +0.000000 +1.000000 

 Press return to continue. 
 NewExpA   n = 1 :
+0.420000 -0.577000 -0.752000 -0.562000 
+0.179000 +0.383000 -0.719000 -0.452000 
-0.625000 +0.309000 +0.522000 +0.061000 
+0.701000 -0.277000 +0.500000 +1.474000 

 ... 

 Press return to continue. 


/* ------------------------------------ */
 ExpA :
+0.519319 -0.319339 -0.418906 -0.461400 
+0.108749 +0.487433 -0.549794 -0.498540 
-0.328677 +0.269455 +0.687243 +0.127971 
+0.539508 -0.345931 +0.417752 +1.513893 


 Press return to continue
 Press X      to stop