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