Aller au contenu

Mathc initiation/Fichiers c : c77cac

Un livre de Wikilivres.


Sommaire


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

c1c.c
/* --------------------------------- */
/* save as c1c.c                     */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fc.h"
/* --------------------------------- */
int main(void)
{
double x  = 1.5;
double y  = 1.3;

 clrscrn();
 
 printf("  (x,y) = (%0.1f,%0.1f)   \n\n\n",x,y);
 
 
 printf("  %s \t\t\t= %0.8f\n", f1eq, f1(x,y));
 printf("  %s \t= %0.8f\n\n\n", f2eq, f2(x,y));
 
 stop();

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


Vérifions par le calcul :
  (x,y) = (1.5,1.3)   


  cos(x) - cos(y)  			            = -0.19676163
  -2.* sin((x+y)/2.) * sin((x-y)/2.) 	= -0.19676163


 Press return to continue.


Vérifions les égalités :
   posons :
     
     cos(x) - cos(y) = -2 sin( (x+y)/2 )   sin( (x-y)/2 )    
     
  Soit :  
                     = -2 sin( x/2 + y/2 ) sin( x/2 - y/2 )      
 
     Nous avons vu que :
    
     sin(x+y) = cos(x) sin(y) + sin(x) cos(y)
     sin(x-y) = sin(x) cos(y) - cos(x) sin(y)   
     
   donc  

     cos(x) + cos(y) = -2 [sin( x/2+y/2 )]
                          [sin( x/2-y/2 )]
     
                     = -2 [cos(x/2) sin(y/2) + sin(x/2) cos(y/2)]
                          [sin(x/2) cos(y/2) - cos(x/2) sin(y/2)]
                          
                          
                     = -2 [  cos(x/2) sin(y/2) sin(x/2) cos(y/2)
                           - cos(x/2)**2 sin(y/2)**2                   
                           + sin(x/2)**2 cos(y/2)**2               
                           - sin(x/2) cos(y/2) cos(x/2) sin(y/2)]                          
                          
                     = -2 [- cos(x/2)**2 sin(y/2)**2                   
                           + sin(x/2)**2 cos(y/2)**2 
                           
                           + cos(x/2) sin(y/2) sin(x/2) cos(y/2)              
                           - sin(x/2) cos(y/2) cos(x/2) sin(y/2)]                            
                          
                          
                     = -2 [- cos(x/2)**2 sin(y/2)**2                   
                           + sin(x/2)**2 cos(y/2)**2 ]                             
                                                                        sin(x/2) = sqrt((1-cos(x))/2)
                                                                        cos(x/2) = sqrt((1+cos(x))/2)                          
                          
                     = -2 [- sqrt((1+cos(x))/2)**2 sqrt((1-cos(y))/2)**2                   
                           + sqrt((1-cos(x))/2)**2 sqrt((1+cos(y))/2)**2 ]                            
                          
                          
                     = -2 [- (1+cos(x))/2 (1-cos(y))/2                  
                           + (1-cos(x))/2 (1+cos(y))/2 ]                             
                          
                          
                     = -2 [- (1+cos(x)) (1-cos(y)) /4                  
                           + (1-cos(x)) (1+cos(y)) /4 ]                            
                          
                     = -1/2 [- (1+cos(x)) (1-cos(y))                  
                             + (1-cos(x)) (1+cos(y)) ]  
                             
                     = -1/2 [-( 1-cos(y)+cos(x)-cos(x)cos(y))
                             +  1+cos(y)-cos(x)-cos(x)cos(y)]                                                        
                          
                     = -1/2 [-  1+cos(y)-cos(x)+cos(x)cos(y) 
                             +  1+cos(y)-cos(x)-cos(x)cos(y)]                             
                                                    
                     = -1/2 [ +cos(y)-cos(x)  
                              +cos(y)-cos(x)]    
                              
                              
                     = -1/2 [ +2cos(y)-2cos(x)]                               
                                                                                     
                     = -2/2 [ cos(y)-cos(x) ]    
                     
                     =      cos(x) - cos(y)