Home>
I am practicing the output of trigonometric functions in Python, but the answer is returned as a negative value.
What is the cause of this?
import math
def ex3_7 (deg):
rad = 2 * math.pi * deg/360
return (rad)
def ex3_8_sin (deg):
rad_sin = math.sin (deg)
return (rad_sin)
def ex3_8_cos (deg):
rad_cos = math.cos (deg)
return (rad_cos)
print (ex3_8_sin (60))
print (ex3_8_cos (60))
 The output result is as follows
0.3048106211022167
0.9524129804151563
Postscript
Make something that calculates ex3_8_sin and ex3_8_cos when the angle θ is given using ex3_7.

Answer # 1

Answer # 2
It's about math.
When 180 °
When 90 ° Therefore, it is normal for the output to be negative.
Related articles
 python 3x  i want to get the nth array with an argument using python3 argparse
 i was given a python 3 assignment as a cram school assignment, but i don't understand "functions and comprehensions, while
 parameter estimation using python's weighted least squares method (wls)
 parallel processing using python multiprocessingpool and multiprocessingqueue does not work well
 about external libraries when using multiple versions of python
 python  i want to separate by a specific word using the split function
 python  image recognition using cnn keras multiple inputs
 python  i don't understand the indexing law of pandasseries i don't know how to take it out
 about batch change of file name using python
 python  what i don't understand about yolo9000 (v2)
 python 3x  how to rename a folder created using jupyternotebook
 python  i'm using selenium the text sent by send_keys to the input tag disappears when the text is sent by send_key to the next
 python 3x  processing to jump to the link destination using chrome driver in python
 python  error in image binarization using cv2adaptivethreshold function
 i want to adjust the execution result using the while statement in python as expected
 python  i want to put the image file path in a variable and open it using that variable
 i don't understand the meaning of x used in a python pandas lambda expression
 python  aggregation processing using pandas
 python  what you do not understand by calculating the precision and recall
Trends
Since the sin function and cos function of math pass radians as arguments
When calculating from angles, degrees need to be converted to radians.
The function for that conversion is the ex3_7 () function.
Therefore
Isn't it okay?