Press "Enter" to skip to content

Cotangent in NumPy: pathetic online Python tutorial

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!

Search results of numpy cotangent
Top three search results of “numpy cotangent”

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:

  1. https://python-tricks.com/mathematical-functions-in-numpy/#The_cosec_function_-_arcsin
  2. https://devenum.com/understanding-trigonometric-function-in-numpy/
  3. https://www.javatpoint.com/numpy-mathematical-functions

 

One Comment

  1. Alex Li Alex Li

    Thanks for notifying this! I had the same question

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.