Aller au contenu

Mathc matrices/a148

Un livre de Wikilivres.


Bibliothèque


Installer ce fichier dans votre répertoire de travail.

vbsm.h
/* ------------------------------------ */
/*  Save as :   vbsm.h                  */
/* ------------------------------------ */
double **Exp_mR(
double **A,
double **ExpA
)
{	
double **A_n     = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **sA      = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **NewExpA = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);

int n = 25; 
int i =  0; 
	
  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);        
       c_mR(NewExpA,ExpA);
   }
   
  f_mR(A_n);
  f_mR(sA);
  f_mR(NewExpA);
   
  return (ExpA);	
}
/* ------------------------------------ */
/* ------------------------------------ */

/* ------------------------------------ */
/* ------------------------------------ */
double **sinh_mR(
double **A,
double **sinhA
)
{	
double **A_n      = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **sA       = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **NewsinhA = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);

int n = 10; 
int i; 
	
  for(i = 1.; i <= n; i+=2.)
   {
     pow_mR(i, A, A_n);         
    smul_mR(1./factorial(i), A_n, sA);      
     add_mR(sinhA,sA,NewsinhA);    
       c_mR(NewsinhA,sinhA);
   }
   
  f_mR(A_n);
  f_mR(sA);
  f_mR(NewsinhA);
   
  return (sinhA);	
}
/* ------------------------------------ */
/* ------------------------------------ */
double **cosh_mR(
double **A,
double **coshA
)
{	
double **A_n      = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **sA       = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **NewcoshA = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);

int n = 10; 
int i; 
	
  for(i = 0.; i <= n; i+=2.)
   {
     pow_mR(i, A, A_n);         
    smul_mR(1./factorial(i), A_n, sA);      
     add_mR(coshA,sA,NewcoshA);    
       c_mR(NewcoshA,coshA);
   }
   
  f_mR(A_n);
  f_mR(sA);
  f_mR(NewcoshA);
   
  return (coshA);	
}
/* ------------------------------------ */
/* ------------------------------------ */

/* ------------------------------------ */
/* ------------------------------------ */
double **sin_mR(
double **A,
double **sinA
)
{	
double **A_n     = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **sA      = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **NewsinA = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);

int n = 10; 
int i;
int j;  
	
  for(i=1.,j=0.; i <= n; i+=2.,j++)
   {
     pow_mR(i, A, A_n);         
    smul_mR(pow((-1),j)/factorial(i), A_n, sA);      
     add_mR(sinA,sA,NewsinA);    
       c_mR(NewsinA,sinA);
   }
   
  f_mR(A_n);
  f_mR(sA);
  f_mR(NewsinA);
   
  return (sinA);	
}
/* ------------------------------------ */
/* ------------------------------------ */
double **cos_mR(
double **A,
double **cosA
)
{	
double **A_n     = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **sA      = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);
double **NewcosA = i_RC_mR(A[R_SIZE][C0],A[C_SIZE][C0]);

int n = 10; 
int i; 
int j; 
	
  for(i=0.,j=0.; i <= n; i+=2.,j++)
   {
     pow_mR(i, A, A_n);         
    smul_mR(pow((-1),j)/factorial(i), A_n, sA);      
     add_mR(cosA,sA,NewcosA);    
       c_mR(NewcosA,cosA);
   }
   
  f_mR(A_n);
  f_mR(sA);
  f_mR(NewcosA);
   
  return (cosA);	
}
/* ------------------------------------ */
/* ------------------------------------ */