Mathc initiation/Fichiers c : c77cab
Installer et compiler ces fichiers dans votre répertoire de travail.
c1b |
---|
/* --------------------------------- */
/* save as c1b.c */
/* --------------------------------- */
#include "x_hfile.h"
#include "fb.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.33823603
2.* cos((x+y)/2.) * cos((x-y)/2.) = 0.33823603
Press return to continue.
Vérifions les égalités :
posons :
cos(x) + cos(y) = 2 cos( (x+y)/2 ) cos( (x-y)/2 )
Soit :
= 2 cos( x/2 + y/2 ) cos( x/2 - y/2 )
Nous avons vu que :
cos(x+y) = cos(x) cos(y) - sin(x) sin(y)
cos(x-y) = cos(x) cos(y) + sin(x) sin(y)
donc
cos(x) + cos(y) = 2 [cos( x/2+y/2 )]
[cos( x/2-y/2 )]
= 2 [cos(x/2) cos(y/2) - sin(x/2) sin(y/2)]
[cos(x/2) cos(y/2) + sin(x/2) sin(y/2)]
= 2 [ cos(x/2)**2 cos(y/2)**2
+ cos(x/2) cos(y/2) sin(x/2) sin(y/2)
- sin(x/2) sin(y/2) cos(x/2) cos(y/2)
- sin(x/2)**2 sin(y/2)**2]
= 2 [ cos(x/2)**2 cos(y/2)**2
+ cos(x/2) cos(y/2) sin(x/2) sin(y/2)
- sin(x/2) sin(y/2) cos(x/2) cos(y/2)
- sin(x/2)**2 sin(y/2)**2]
= 2 [ cos(x/2)**2 cos(y/2)**2
- sin(x/2)**2 sin(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) ]
= cos(y) + cos(x)