10
Trigonométrie
- #include <stdio.h>
- #include <math.h>
- main() {
- float x;
- /* empirical demonstration that sin(2x) = 2sin(x) * cos(x) */
- for ( x = 0; x < 2.0; x += 0.2 )
- printf("\t%.1f\t\t%f\t%f\n", x, sin(2*x), 2*sin(x) * cos(x));
- }
$ gcc -o trigo trigo.c
$ ./trigo
0.0 0.000000 0.000000
0.2 0.389418 0.389418
0.4 0.717356 0.717356
0.6 0.932039 0.932039
0.8 0.999574 0.999574
1.0 0.909297 0.909297
1.2 0.675463 0.675463
1.4 0.334988 0.334988
1.6 -0.058374 -0.058374
1.8 -0.442521 -0.442521
Commentaires