Movatterモバイル変換


[0]ホーム

URL:


Python Tutorial

Python cmath.atan() Function



The Pythoncmath.atan() function returns the arc tangent of a number in radians.

The arc tangent is defined as the inverse of a tangent function. The domain of the arc tangent function is in the range between [-,], and its range is obtained in the form of radians.

Syntax

Following is the syntax for the Pythoncmath.atan() function −

cmath.atan(x)

Parameters

This function contains numeric values.

Return Value

This method returns arc tangent of x in radians.

Example 1

In the following example we are using Pythoncmath.atan() function as we are finding the arc tangent values of '0', '-1' and '1'.

import cmathzero = cmath.atan(0)neg_one = cmath.atan(-1)pos_one = cmath.atan(1)print("Arc Tangent value of 0:", zero)print("Arc Tangent value of -1:", neg_one)print("Arc Tangent value of 1:", pos_one)

Output

When we run the above code, it produces the following result −

Arc Tangent value of 0: 0jArc Tangent value of -1: (-0.7853981633974483+0j)Arc Tangent value of 1: (0.7853981633974483+0j)

Example 2

Here, we are passing non-standard tangent ratios as arguments usingarc sine() function.

import cmathx = cmath.atan(0.234)y = cmath.atan(-3.4)print(x,y)

Output

If we compile the above program, the output is as follows −

(0.2298640844033592+0j) (-1.2847448850775784+0j)

Example 3

In the below example we are calculating complex values usingcmath.atan() function.

import cmathprint(cmath.atan(2 + 3j))print(cmath.atan(5 - 4j))

Output

When we run the above code, we will get the result as −

(1.4099210495965755+0.22907268296853878j)(1.4483069952314644-0.09641562020299617j)
python_modules.htm
Print Page
Advertisements

[8]ページ先頭

©2009-2025 Movatter.jp