Aller au contenu

Mathc complexes/a138

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
/* ------------------------------------ */
double **sinh_mZ(
double **A,
double **sinhA
)
{	
double **A_n     = i_mZ(RCA,RCA);
double **sA      = i_mZ(RCA,RCA);
double **NewsinhA = i_mZ(RCA,RCA);

int n = 10; 
int i; 
	
  for(i = 1.; i <= n; i+=2.)
   {
     pow_mZ(i, A, A_n);         
    smul_mZ(1./factorial(i), A_n, sA);      
     add_mZ(sinhA,sA,NewsinhA);    
       c_mZ(NewsinhA,sinhA);
   }
   
  f_mZ(A_n);
  f_mZ(sA);
  f_mZ(NewsinhA);
   
  return (sinhA);	
}
/* ------------------------------------ */
double **cosh_mZ(
double **A,
double **coshA
)
{	
double **A_n     = i_mZ(RCA,RCA);
double **sA      = i_mZ(RCA,RCA);
double **NewcoshA = i_mZ(RCA,RCA);

int n = 10; 
int i; 
	
  for(i = 0.; i <= n; i+=2.)
   {
     pow_mZ(i, A, A_n);         
    smul_mZ(1./factorial(i), A_n, sA);      
     add_mZ(coshA,sA,NewcoshA);    
       c_mZ(NewcoshA,coshA);
   }
   
  f_mZ(A_n);
  f_mZ(sA);
  f_mZ(NewcoshA);
   
  return (coshA);	
}
/* ------------------------------------ */
void fun(void)
{
double **A    = rE_mZ(i_mZ(RCA,RCA),999,+1.E-3); 
double **sinhA =      i_mZ(RCA,RCA);   
double **coshA =      i_mZ(RCA,RCA);
double **sinhA2 =     i_mZ(RCA,RCA);   
double **coshA2 =     i_mZ(RCA,RCA);
      
   clrscrn();   
   printf(" Copy/Past into the octave window.       \n");
   p_Octave_mZ(A, "A", P4, P4);
   stop();

   clrscrn();    
   sinh_mZ(A, sinhA);
   cosh_mZ(A, coshA);   
   
   printf(" sinhA :");
   p_mZ(sinhA,S8,P4,S8,P4,C6);
   printf(" coshA :");
   p_mZ(coshA,S8,P4,S8,P4,C6);   
   stop();

   clrscrn(); 
   pow_mZ(2, sinhA, sinhA2);
   pow_mZ(2, coshA, coshA2); 
   
   printf(" sinhA2 :");
   p_mZ(sinhA2,S8,P4,S8,P4,C6);
   printf(" coshA2 :");
   p_mZ(coshA2,S8,P4,S8,P4,C6); 
      
   sub_mZ(coshA2,sinhA2,A);  
   printf(" I = coshA**2  -sinhA**2 ");
   p_mZ(A,S8,P4,S8,P4,C6);     

   f_mZ(A);
   f_mZ(sinhA);
   f_mZ(coshA);
   f_mZ(sinhA2);   
   f_mZ(coshA2);     
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */


         SinhA =   + A + (1/3!) A**3 + (1/5!) A**5  + (1/7!) A**7 + ...
 
         CoshA =   + I + (1/2!) A**2 + (1/4!) A**4  + (1/6!) A**6 + ...


Exemple de sortie écran :
 ------------------------------------
 Copy/Past into the octave window.       
 A=[
-0.7110-0.2820*i,+0.9690+0.3400*i,-0.7490+0.2580*i,-0.7870-0.2340*i;
+0.2270-0.8850*i,-0.1960-0.1930*i,+0.8890+0.1610*i,-0.8310-0.5870*i;
+0.0940-0.1340*i,+0.5990+0.0070*i,-0.6260-0.3830*i,-0.8070+0.6500*i;
+0.8860-0.2130*i,+0.8160+0.6990*i,-0.9710+0.4340*i,-0.1000+0.7810*i]

 Press return to continue. 


 ------------------------------------
 sinhA :
 -0.9659 -0.3830i  +1.6315 +0.2555i  -1.2631 +0.1512i  -0.8854 +0.5387i 
 +0.1635 -0.8868i  -0.6805 -0.0675i  +1.2034 -0.4361i  -1.0993 -0.4909i 
 -0.0066 -0.1089i  +0.7196 -0.1119i  -0.8113 -0.4498i  -0.5266 +0.9743i 
 +0.7110 -0.4493i  +0.9865 +0.3332i  -0.7264 +0.6652i  +0.1354 +0.5731i 

 coshA :
 +1.1366 -0.0708i  -1.1381 -0.6372i  +1.6349 +0.1294i  +0.1605 -1.0191i 
 -0.7492 +0.2510i  +1.3813 -0.9341i  +0.0949 +0.1506i  -0.1643 +0.5562i 
 -0.2535 +0.2012i  -0.7984 -0.1404i  +1.5888 -0.1918i  -0.1818 -0.4937i 
 +0.0802 +0.0444i  -0.0773 +0.2843i  +0.3181 +0.1979i  +0.3177 -0.9683i 

 Press return to continue. 


 ------------------------------------
 sinhA2 :
 +0.9171 +0.2523i  -4.5159 -0.6690i  +4.7304 -0.6011i  -0.5173 -3.0077i 
 -1.7264 +1.4030i  +0.8481 -2.6122i  -0.9682 +0.7984i  +0.9715 +1.9870i 
 +0.0028 +0.4720i  -1.9583 +0.4010i  +1.0323 -0.6400i  -0.5456 -0.8607i 
 +0.0289 -0.2373i  +0.1205 +0.3257i  +0.9113 +0.1066i  -1.8840 -0.9725i 

 coshA2 :
 +1.9171 +0.2523i  -4.5159 -0.6690i  +4.7304 -0.6011i  -0.5173 -3.0077i 
 -1.7264 +1.4030i  +1.8481 -2.6122i  -0.9682 +0.7984i  +0.9715 +1.9870i 
 +0.0028 +0.4720i  -1.9583 +0.4010i  +2.0323 -0.6400i  -0.5456 -0.8607i 
 +0.0289 -0.2373i  +0.1205 +0.3257i  +0.9113 +0.1066i  -0.8840 -0.9725i 

 I = coshA**2  -sinhA**2 
 +1.0000 -0.0000i  -0.0000 +0.0000i  +0.0000 -0.0000i  -0.0000 +0.0000i 
 +0.0000 +0.0000i  +1.0000 -0.0000i  -0.0000 +0.0000i  +0.0000 +0.0000i 
 +0.0000 -0.0000i  -0.0000 +0.0000i  +1.0000 -0.0000i  +0.0000 +0.0000i 
 -0.0000 -0.0000i  -0.0000 -0.0000i  +0.0000 -0.0000i  +1.0000 +0.0000i 


 Press return to continue
 Press X      to stop