Tutorial Gateway

  • C
  • C#
  • Java
  • Python
  • SQL
  • MySQL
  • Js
  • BI Tools
    • Informatica
    • Talend
    • Tableau
    • Power BI
    • SSIS
    • SSRS
    • SSAS
    • MDX
    • R Tutorial
    • Alteryx
    • QlikView
  • More
    • C Programs
    • C++ Programs
    • Go Programs
    • Python Programs
    • Java Programs

Python numpy Trigonometric Functions

by suresh

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

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 sin

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 cos

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 tan

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 sinh

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 cosh

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 tanh

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 arcsinh

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 arccosh

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 arctanh

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 arcsin

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 arccos

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 arctan

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 arctan2

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 hypot

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 radians

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 degrees

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 deg2rad

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 rad2deg

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)
Python NumPy unwrap

Placed Under: Python

  • Download and Install Python
  • Python Arithmetic Operators
  • Python Assignment Operators
  • Python Bitwise Operators
  • Python Comparison Operators
  • Python Logical Operators
  • Python If Statement
  • Python If Else
  • Python Elif Statement
  • Python Nested If
  • Python For Loop
  • Python While Loop
  • Python Break
  • Python Continue
  • Python Dictionary
  • Python datetime
  • Python String
  • Python Set
  • Python Tuple
  • Python List
  • Python List Comprehensions
  • Python Lambda Function
  • Python Functions
  • Python Types of Functions
  • Python Iterator
  • Python File Handling
  • Python Directory
  • Python Class
  • Python classmethod
  • Python Inheritance
  • Python Method Overriding
  • Python Static Method
  • Connect Python and SQL Server
  • Python SQL Create DB
  • Python SQL Select Top
  • Python SQL Where Clause
  • Python SQL Order By
  • Python SQL Select Statement
  • Python len Function
  • Python max Function
  • Python map Function
  • Python print Function
  • Python sort Function
  • Python range Function
  • Python zip Function
  • Python Math Functions
  • Python String Functions
  • Python List Functions
  • Python NumPy Array
  • NumPy Aggregate Functions
  • NumPy Arithmetic Operations
  • Python Numpy Bitwise operators
  • Numpy Comparison Operators
  • Numpy Exponential Functions
  • Python Numpy logical operators
  • Python numpy String Functions
  • NumPy Trigonometric Functions
  • Python random Array
  • Python numpy concatenate
  • Python numpy Array shape
  • Python pandas DataFrame
  • Pandas DataFrame plot
  • Python Series
  • Python matplotlib Histogram
  • Python matplotlib Scatter Plot
  • Python matplotlib Pie Chart
  • Python matplotlib Bar Chart
  • Python List Length
  • Python sort List Function
  • Python String Concatenation
  • Python String Length
  • Python substring
  • Python Programming Examples

Copyright © 2021· All Rights Reserved.
About | Contact | Privacy Policy