## How to use degrees with trigonometric functions?

A forum for general discussion of the Python programming language.

### How to use degrees with trigonometric functions?

Hello everyone!

I'm trying to get myself around how trigonometric functions from the math module work in Python, after, lots of errors, I noticed that for example the return value of "tan()" is in radians (finally got to "help(tan)" ), but when I try to convert the radians to degrees the answer doesn't make sense to me, Im very rusted in this topic:

wolfram: tan(7) = 0.122784560903...
Kcalc: tan(7) = 0.122784560903 # Deg mode
python: degrees(tan(7)) = 49.93029147529294

I'm trying to define an extended set of trig functions, sec, cot, etc, but I don't really understand how to use the normal ones to get tan(7) = 0.122784560903

ismaelvc

Posts: 7
Joined: Tue Apr 01, 2014 3:35 pm

### Re: How to use degrees with trigonometric functions?

You have to give math.tan() a number of radians.
That means you have to convert your number from degrees to radians, not the other way around:
Code: Select all
`>>> import math>>> math.radians(7)0.12217304763960307>>> math.tan(math.radians(7))0.1227845609029046`
Friendship is magic!

R.I.P. Tracy M. You will be missed.

stranac

Posts: 1790
Joined: Thu Feb 07, 2013 3:42 pm

### Re: How to use degrees with trigonometric functions?

Thank you very much stranac!
ismaelvc

Posts: 7
Joined: Tue Apr 01, 2014 3:35 pm