Python atan

The Python atan function calculates the trigonometry Arc Tangent for the specified expression. Arc Tangent is also called the inverse of a Tangent.

In this section, let us discuss how to use atan function in Python Programming language with an example, and the syntax of it is

math.atan(number);

Number: It can be a number or a valid numerical expression for which you want to find the Arc Tangent value.

  • If the number argument is a positive or negative number, the. Python atan function returns the Arc Tangent value.
  • If the number argument is not a number, it returns TypeError.

Python atan Function Example

The Python atan Function allows you to find the trigonometry Arc Tangent of the numeric values. In this atan example, We are going to find the Arc Tangent values of different data types and display the output.

First, we used the atan Function directly on both the Positive integer and negative integer. The first two Python statements find the Arc Tangent of the corresponding values.

Next, We used the atan Function on Tuple and List items. If you see the below image, it is working perfectly on them. Next, We used the atan Math function directly on multiple values.

Within the last statement, we used the math atan Function on the string value, and it returns TypeError. Please refer to the tan Function article to understand the Tangent Function.

import math

Tup = (0.21, 0.12, 0.39, -0.89 , 0.42)
Lis = [-0.1, 0.92, 0.35, -0.46 , 0.85]

print('Arc Tangent value of Positive Number = %.2f' %math.atan(1))
print('Arc Tangent value of Negative Number = %.2f' %math.atan(-1))

print('Arc Tangent value of Tuple Item = %.2f' %math.atan(Tup[3]))
print('Arc Tangent value of List Item = %.2f' %math.atan(Lis[2]))

print('Arc Tangent value of Multiple Number = %.2f' %math.atan(0.10 + 0.20 - 0.40))

print('Arc Tangent value of String Value = ', math.atan('Hello'))
Python ATAN Function Example