numpy
  1. numpy-arctan

arctan() - ( NumPy Functions )

Heading h2

Syntax

numpy.arctan(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, ufunc 'arctan')

Example

import numpy as np

arr = np.array([0, 1, -1, np.inf, -np.inf])

print(np.arctan(arr))

Output

[ 0.          0.78539816 -0.78539816  1.57079633 -1.57079633]

Explanation

The arctan() function in NumPy returns the trigonometric inverse tangent of the elements of an array. It returns the angles in radians between -pi/2 and pi/2.

arr is an array containing values for which we want to get the inverse tangent. The arctan() function returns an array containing the inverse tangent of each number in the input array.

Use

The arctan() function in NumPy is used to get the trigonometric inverse tangent of the elements of an array. It is useful in mathematical and scientific computations where inverse tangent values are needed.

Important Points

  • The arctan() function returns the trigonometric inverse tangent of the elements of an array.
  • The returned angles are in radians and lie between -pi/2 and pi/2.

Summary

In conclusion, the arctan() function in NumPy is used to get the trigonometric inverse tangent of the elements of an array. It returns the angles in radians between -pi/2 and pi/2. This function is useful in mathematical and scientific computations where inverse tangent values are needed.

Published on: