
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Compute the inverse hyperbolic tangent with scimath in Python
To compute the inverse hyperbolic tangent with arctanh, use the numpy.emath.arctanh() method in Python. Returns the “principal value” of arctanh(x). For real x such that abs(x) < 1, this is a real number. If abs(x) > 1, or if x is complex, the result is complex. Finally, x = 1 returns``inf`` and x=-1 returns -inf.
The method returns the inverse hyperbolic tangent(s) of the x value(s). If x was a scalar so is out, otherwise an array is returned. The 1st parameter is the value(s) whose arctanh is (are) required.
Steps
At first, import the required libraries −
import numpy as np
Create a numpy array using the array() method −
arr = np.array([0, 1j, 2j])
Display the array −
print("Array...\n", arr)
Get the type of the array −
print("\nOur Array type...\n", arr.dtype)
Get the dimensions of the Array −
print("\nOur Array Dimensions...\n",arr.ndim)
To compute the inverse hyperbolic tangent with arctanh, use the numpy.emath.arctanh() method in Python −
print("\nResult...\n",np.emath.arctanh(arr))
Example
import numpy as np # Create a numpy array using the array() method arr = np.array([0, 1j, 2j]) # Display the array print("Array...\n", arr) # Get the type of the array print("\nOur Array type...\n", arr.dtype) # Get the dimensions of the Array print("\nOur Array Dimensions...\n",arr.ndim) # Get the number of elements in the Array print("\nNumber of elements...\n", arr.size) # To compute the inverse hyperbolic tangent with arctanh, use the numpy.emath.arctanh() method in Python print("\nResult...\n",np.emath.arctanh(arr))
Output
Array... [0.+0.j 0.+1.j 0.+2.j] Our Array type... complex128 Our Array Dimensions... 1 Number of elements... 3 Result... [0.+0.j 0.+0.78539816j 0.+1.10714872j]
- Related Articles
- Compute the inverse Hyperbolic tangent in Python
- Compute the inverse Hyperbolic tangent of array elements in Python
- Compute the inverse cosine with scimath in Python
- Compute the inverse sine with scimath in Python
- Compute the Hyperbolic tangent in Python
- Compute the inverse Hyperbolic sine in Python
- Compute the inverse Hyperbolic cosine in Python
- Compute the Hyperbolic tangent of the array elements in Python
- Compute the inverse Hyperbolic sine of array elements in Python
- Compute the inverse Hyperbolic cosine of array elements in Python
- Compute the natural logarithm with scimath in Python
- Finding the Inverse Hyperbolic Tangent of Complex Number in Golang
- Finding the Inverse Hyperbolic Tangent of Specified Number in Golang
- How to compute the inverse cosine and inverse hyperbolic cosine in PyTorch?
- How to compute the inverse hyperbolic sine in PyTorch?
