Python numpy module has various trigonometric functions such as sin, cos, tan, sinh, cosh, tanh, arcsin, arccos, arctan, arctan2, arcsinh, arccosh, arctanh, radians, degrees, hypot, deg2rad, rad2deg, and unwrap. Use these Python numpy Trigonometric Functions on both one dimensional and multi-dimensional arrays.
We use the below arrays to demonstrate the Python numpy Trigonometric Function.
arr1 = np.array([0, 30, 45, 60, 90, 180]) arr1 arr2 = np.random.randint(0, 10, size = (10)) arr2 arr3 = np.random.randint(10, size = (5, 5)) arr3 arr4 = np.random.random((10)) arr4 arr5 = np.random.random((5, 5)) arr5 arr6 = np.linspace(-1, 1, 10) arr6
Python numpy Trigonometric Functions Examples
The list of available Python numpy Trigonometric Functions with an example of each.
Python numpy sin
Python numpy sin function returns the sine value of a given array.
np.sin(arr1) np.sin(arr2) np.sin(arr3) np.sin(arr6)
Python numpy cos
The Python numpy cos function returns the cosine value of a given array.
np.cos(arr1) np.cos(arr2) np.cos(arr3) np.cos(arr6)
Python numpy tan
The Python numpy tan function returns the tangent value of a given array.
np.tan(arr1) np.tan(arr2) np.tan(arr3) np.tan(arr6)
Python numpy sinh
The Python numpy sinh function returns the hyperbolic sine value of a given array.
np.sinh(arr1) np.sinh(arr2) np.sinh(arr3)
Python numpy cosh
The Python numpy cosh function prints the hyperbolic cosine value of all the elements in a given Python array.
np.cosh(arr1) np.cosh(arr2) np.cosh(arr3)
Python numpy tanh
The Python numpy tanh function display the hyperbolic tangent values of a given array.
np.tanh(arr1) np.tanh(arr2) np.tanh(arr3)
Python NumPy arcsinh
The Python numpy arcsinh function returns the hyperbolic arc sine value of a given array.
np.arcsinh(arr1) np.arcsinh(arr2) np.arcsinh(arr3)
Python numpy arccosh
The Python numpy arccosh function returns the hyperbolic arc cosine value of all the elements in a given array.
np.arccosh(arr1) np.arccosh(arr2) np.arccosh(arr3)
Python numpy arctanh
The Python numpy arctanh function returns the hyperbolic arc tangent values of a given array.
np.arctanh(arr4) np.arctanh(arr5) np.arctanh(arr6)
Python numpy arcsin
The Python numpy arcsin function returns the arc sine values of a given array.
np.arcsin(arr4) np.arcsin(arr5) np.arcsin(arr6)
Python numpy arccos
The Python numpy arccos function returns the given array arc cosine values.
np.arccos(arr4) np.arccos(arr5) np.arccos(arr6)
Python numpy arctan
This Python numpy arctan function returns the arc tangent values of an array.
np.arctan(arr1) np.arctan(arr2) np.arctan(arr3)
Python numpy arctan2
The Python numpy arctan2 function returns the element-wise arc tangent values of an array. It accepts two arrays as arguments x1 and x2 and returns x1/x2.
np.arctan2(arr2, arr6) np.arctan2(arr6, arr2) np.arctan2(arr3, arr5) np.arctan2(arr5, arr3)
Python numpy hypot
Python numpy hypot function returns the hypotenuse of the arguments x1 and x2.
np.hypot(arr2, arr6) np.hypot(arr3, arr5)
Python numpy radians
The Python numpy radians function converts angles from degrees to radians in an array
np.radians(arr1) np.radians(arr1 * 30) np.radians(arr1 * 180) np.radians(arr2 * 90) np.radians(arr3 * 180) np.radians(arr4) np.radians(arr5 * 180)
Python numpy degrees
The Python numpy degrees function converts angles from radians to degrees in an array
np.degrees(arr1) np.degrees(arr1/30) np.degrees(arr1/60) np.degrees(arr2) np.degrees(arr3/30) np.degrees(arr4) np.degrees(arr5)
Python NumPy deg2rad
The Python numpy deg2rad function converts from degrees to radians. deg2rad(n) is similar or equal to n * pi / 180 (pi or np.pi holds value 3.14)
np.deg2rad(180) np.deg2rad(arr1) x = np.array([0, 30, 60, 90, 120, 180, 360]) np.deg2rad(x)
Python numpy rad2deg
The Python numpy rad2deg function converts from radians to degrees. rad2deg(n) is similar or equal to 180 * n / pi (pi = 3.14)
np.rad2deg(5) np.rad2deg(arr2) np.rad2deg(arr5) np.rad2deg(arr6)
Python numpy unwrap
Python numpy unwrap function unwraps the values by changing deltas between values.
np.unwrap(arr2) np.unwrap(arr3) np.unwrap(arr4) np.unwrap(arr5) np.unwrap(arr6)