I have programmed the following function:
def horizontal(yAngle, yAcceleration, xAcceleration):
a = (math.cos(yAngle)*yAcceleration)-(math.sin(yAngle)*xAcceleration)
return a
The problem is the following: math.cos()
and math.sin()
return a value in radians. I want that value, which I get from math.cos()
and math.sin()
, in degrees.
So the calculation should be like this: First the value which comes in math.cos(x) and math.sin(x) instead of x is output in radians. (This means that there are two values at the end, because they are two different functions, which get the same value). These two values should now be converted into degrees. The calculation should then proceed as follows: a = ((Value from cos in degrees) *yAcceleration)-( (Value from sin in degrees) *xAcceleration)
I find out that there are the functions math.degrees
and math.radians
in Python. I just tried different options but nothing was the right one. Could someone show me how to use it correctly?
How can I reach this? Thanks for helping me!