Aller au contenu

Mathc complexes/a129

Un livre de Wikilivres.


Application


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


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

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

double **ExpA      = i_mZ(RCA,RCA);   
double **NewExpA   = i_mZ(RCA,RCA);   
       
   clrscrn();   
   printf(" Copy/Past into the octave window.       \n\n");
   p_Octave_mZ(A, "A", P3, P3);
   printf(" expm (A)\n\n\n");
  
   for(i = 0; i <= n; i++)
    {
     pow_mZ(i, A, A_n);    
    smul_mZ(1./factorial(i), A_n, sA);    
     add_mZ(ExpA,sA,NewExpA);        
       c_mZ(NewExpA,ExpA);
    }
    
  printf(" ExpA :");
  p_mZ(ExpA,S8,P6,S8,P6,C4);

  f_mZ(A);
  f_mZ(A_n);
  f_mZ(sA);
  f_mZ(ExpA);
  f_mZ(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.931+0.156*i,+0.215-0.504*i,+0.875-0.822*i,+0.418-0.106*i;
+0.288-0.738*i,-0.932+0.063*i,+0.568+0.540*i,-0.662+0.345*i;
+0.288-0.616*i,+0.123-0.495*i,-0.172+0.494*i,-0.964-0.190*i;
-0.433-0.191*i,+0.004-0.803*i,+0.847-0.280*i,+0.011-0.540*i]

 expm (A)


 ExpA :
+0.278034-0.263946i +0.039443-0.359540i +0.677053-0.373020i -0.103917+0.213178i 
+0.333674-0.267614i +0.448775+0.064881i +0.063273+0.212616i -0.428475+0.081523i 
+0.288970-0.221687i +0.035377-0.072844i +0.506777+0.130905i -0.716659-0.053923i 
-0.431989-0.282729i -0.199920-0.509689i +0.524032-0.342780i +0.620337-0.224214i 


 Press return to continue
 Press X      to stop