Série de Taylor


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


c00f.c
/* ------------------------------------ */
/*  Save as :   c00f.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define   RCA        RC4
/* ------------------------------------ */
void fun(void)
{
double **A    = rE_mR(i_mR(RCA,RCA),999,+1.E-3); 
double **sinA =      i_mR(RCA,RCA);   
double **cosA =      i_mR(RCA,RCA);
double **sinA2 =     i_mR(RCA,RCA);   
double **cosA2 =     i_mR(RCA,RCA);
      
   clrscrn();    
   sin_mR(A, sinA);
   cos_mR(A, cosA);   
   
   printf(" sinA :");
   p_mR(sinA,S8,P4,C6);
   printf(" cosA :");
   p_mR(cosA,S8,P4,C6);   
   stop();

   clrscrn(); 
   pow_mR(2, sinA, sinA2);
   pow_mR(2, cosA, cosA2); 
   
   printf(" sinA2 :");
   p_mR(sinA2,S8,P4,C6);
   printf(" cosA2 :");
   p_mR(cosA2,S8,P4,C6); 
      
   add_mR(cosA2,sinA2,A);  
   printf(" I = cosA**2  + sinA**2 ");
   p_mR(A,S8,P4,C6);     
   
   f_mR(A);
   f_mR(sinA);   
   f_mR(cosA);
   f_mR(sinA2);
   f_mR(cosA2);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

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

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


     SinA =   + A - (1/3!) A**3 + (1/5!) A**5  - (1/7!) A**7 + ...
  
     CosA =   + I - (1/2!) A**2 + (1/4!) A**4  - (1/6!) A**6 + ...

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

                         I = cosA**2  + sinA**2 


Exemple de sortie écran :
 ------------------------------------ 
 Copy/Past into the octave window.       
 A=[
+0.6960,-0.8400,+0.8480,+0.8550;
-0.5360,+0.5670,+0.9980,+0.8660;
+0.5170,-0.9590,+0.4840,-0.1850;
+0.1040,+0.2210,+0.4630,-0.0580]

 Press return to continue. 


 ------------------------------------ 
 sinA :
 -0.3578  +0.3995  -0.8897  -0.9031 
 +0.6010  -0.7135  -0.9347  -0.9026 
 -0.3042  +0.7121  -0.6359  +0.1423 
 -0.0062  -0.3516  -0.4447  +0.0079 

 cosA :
 +0.3822  +0.7146  -0.3288  +0.1491 
 +0.0742  +0.9449  -0.5176  +0.0809 
 -0.5025  +0.6955  +1.1452  +0.2335 
 -0.0574  +0.1626  -0.2688  +0.8936 

 Press return to continue. 

 ------------------------------------ 
 sinA2 :
 +0.6442  -0.7439  +0.9122  -0.1712 
 -0.3539  +0.4009  +1.1279  -0.0389 
 +0.7293  -1.1325  -0.0540  -0.4574 
 -0.0739  -0.0710  +0.6134  +0.2597 

 cosA2 :
 +0.3558  +0.7439  -0.9122  +0.1712 
 +0.3539  +0.5991  -1.1279  +0.0389 
 -0.7293  +1.1325  +1.0540  +0.4574 
 +0.0739  +0.0710  -0.6134  +0.7403 

 I = cosA**2  + sinA**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