Python atan

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

In this section, let us discuss how to use atan function in Python Programming language with example. And the syntax of the atan Function in Python is

math.atan(number);

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

  • If the number argument is a positive or negative number, 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