I never thought one day I would want to write a post regarding calculating cotangent with NumPy in Python. Isn’t cotangent just the inverse of tangent? Can’t we calculate cotangent just by one over tangent? Yes, cotangent is simple. It’s probably mid-school math. However, if you’ve ever searched
numpy cotangent on Google, you would be surprised that two of the top three search results (see the figure) are completely wrong. How pathetic!
As you can see from the figure, the second and the third search result say you can use
arctan to calculate cotangent. Well… no! You definitely cannot use
arctan to calculate cotangent.
arctan is the inverse function of
tan, meaning if
y = tan(x), then
x = arctan(y), and it is totally different from cotangent.
If you look further into other search results down the list, you will find more results showing this wrong information. This well explains how false information and fake news propagate on the internet. How pathetic!
Here are some results showing wrong information, for your reference: