Aller au contenu

Mathc matrices/a81

Un livre de Wikilivres.


Série de Taylor


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


c00e.c
/* ------------------------------------ */
/*  Save as :   c00e.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RCA        RC4
/* ------------------------------------ */
void fun(void)
{
double **A    = rE_mR(i_mR(RCA,RCA),999,+1.E-3); 
double **sinhA =      i_mR(RCA,RCA);   
double **coshA =      i_mR(RCA,RCA);
double **sinhA2 =     i_mR(RCA,RCA);   
double **coshA2 =     i_mR(RCA,RCA);
      
   clrscrn();    
   sinh_mR(A, sinhA);
   cosh_mR(A, coshA);   
   
   printf(" sinhA :");
   p_mR(sinhA,S8,P4,C6);
   printf(" coshA :");
   p_mR(coshA,S8,P4,C6);   
   stop();

   clrscrn(); 
   pow_mR(2, sinhA, sinhA2);
   pow_mR(2, coshA, coshA2); 
   
   printf(" sinhA2 :");
   p_mR(sinhA2,S8,P4,C6);
   printf(" coshA2 :");
   p_mR(coshA2,S8,P4,C6); 
      
   sub_mR(coshA2,sinhA2,A);  
   printf(" I = coshA**2  -sinhA**2 ");
   p_mR(A,S8,P4,C6);  

   f_mR(A);
   f_mR(sinhA);
   f_mR(coshA);
   f_mR(sinhA2);
   f_mR(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 + ...


 Dans cet exemple je vous propose deux fonctions sinh_mR() et cosh_mR(), puis on vérifie une propriété de ces fonctions : 

         I = coshA**2  -sinhA**2 

 
Exemple de sortie écran :
 ------------------------------------ 
 Copy/Past into the octave window.       
 A=[
+0.6170,+0.9630,+0.8290,-0.7990;
-0.8750,+0.2740,-0.6240,-0.7260;
-0.9490,+0.1990,-0.5240,+0.9020;
+0.3820,-0.2960,-0.8550,+0.7330]

 Press return to continue. 


 ------------------------------------ 
 sinhA :
 +0.2146  +0.8186  +0.6265  -0.8283 
 -0.8622  +0.1971  -0.5423  -0.6433 
 -0.5174  +0.0929  -0.3827  +0.9124 
 +0.4605  -0.0363  -0.6258  +0.5427 

 coshA :
 +0.2359  +0.5130  +0.0507  -0.4597 
 -0.2261  +0.6569  +0.0113  -0.2519 
 +0.1014  -0.5108  +0.3835  +0.3687 
 +0.6745  +0.0149  +0.1479  +0.7904 

 Press return to continue. 


 ------------------------------------ 
 sinhA2 :
 -1.3653  +0.4253  -0.0308  -0.5823 
 -0.3706  -0.6940  -0.0369  -0.2565 
 +0.4270  -0.4739  -0.7991  +0.5148 
 +0.7039  +0.2920  +0.2080  -0.6345 

 coshA2 :
 -0.3653  +0.4253  -0.0308  -0.5823 
 -0.3706  +0.3060  -0.0369  -0.2565 
 +0.4270  -0.4739  +0.2009  +0.5148 
 +0.7039  +0.2920  +0.2080  +0.3655 

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


 Press return to continue
 Press X      to stop