For starters, the circular functions - sine, cosine and tangent - are obtained through the trigonometric circle. This, in turn, goes from 0 to 360°. So it makes no sense to table the sines in the interval 0 to 390°, since the values of 360° to 390° are equal to those of the interval of 0 to 30°.
Another thing, the values of the sines included in the interval [1, 179], have signal POSITIVE. The sines corresponding to 0 and 180° have value NULL and the sines included in the interval [181, 359], have signal NEGATIVE.
In addition, sine calculation is always based on radians.
Taking all these observations into consideration, we can implement the following code:
from math import sin, radians
print('Ciclo do seno de "0" à "360°" com intervalo de "10°"')
for i in range(0, 361, 10):
if 0 <= i < 360:
print(f'{f"{i:<4} = "}{sin(radians(i)):.4f}')
else:
print(f'{f"{i:<4} = 0.0000"}')
Note that the block for traverses the range(0, 361, 10), I mean, go through the 0 to 361° - 1, that is, the interval 0 to 360°, jumping from 10 to 10°.
Note that the temporary variable of the block for, that is, the variable i, corresponds to the value in degrees. And therefore I don’t need to convert tau value again into degrees - applying the function degrees().
Finally we can calculate the sine and display the result with 4 decimal places.
thanks for the comment, however are appearing values above 390 and did not use the sine... I think the most correct result complementing your reply would be:
for a in range(0,391,10): print(math.degrees(math.sin(a)))
– Diogo
I’m sorry, my fault:
for a in range(0,391,10): print(math.sin(math.degrees(a)))
– Augusto Vasques