Trig Functions in Python
Here is an example doing trigonometric functions in Python:
#!/usr/bin/python3 import math # Uses simple trig functions from the math library # Make sure to import math lib # https://docs.python.org/3/library/math.html def main(): # Sample cos(x) at each degree from 0-359 cos_vals = [math.cos(math.radians(i)) for i in range(360)] print("cos(x)") print(cos_vals) # Sample cos(x) at each degree from 0-359 sin_vals = [math.sin(math.radians(i)) for i in range(360)] print("sin(x)") print(sin_vals) if __name__ == '__main__': main()
Uses the Python math library: https://docs.python.org/3/library/math.html