
- NumPy - Home
- NumPy - Introduction
- NumPy - Environment
- NumPy Arrays
- NumPy - Ndarray Object
- NumPy - Data Types
- NumPy Creating and Manipulating Arrays
- NumPy - Array Creation Routines
- NumPy - Array Manipulation
- NumPy - Array from Existing Data
- NumPy - Array From Numerical Ranges
- NumPy - Iterating Over Array
- NumPy - Reshaping Arrays
- NumPy - Concatenating Arrays
- NumPy - Stacking Arrays
- NumPy - Splitting Arrays
- NumPy - Flattening Arrays
- NumPy - Transposing Arrays
- NumPy Indexing & Slicing
- NumPy - Indexing & Slicing
- NumPy - Indexing
- NumPy - Slicing
- NumPy - Advanced Indexing
- NumPy - Fancy Indexing
- NumPy - Field Access
- NumPy - Slicing with Boolean Arrays
- NumPy Array Attributes & Operations
- NumPy - Array Attributes
- NumPy - Array Shape
- NumPy - Array Size
- NumPy - Array Strides
- NumPy - Array Itemsize
- NumPy - Broadcasting
- NumPy - Arithmetic Operations
- NumPy - Array Addition
- NumPy - Array Subtraction
- NumPy - Array Multiplication
- NumPy - Array Division
- NumPy Advanced Array Operations
- NumPy - Swapping Axes of Arrays
- NumPy - Byte Swapping
- NumPy - Copies & Views
- NumPy - Element-wise Array Comparisons
- NumPy - Filtering Arrays
- NumPy - Joining Arrays
- NumPy - Sort, Search & Counting Functions
- NumPy - Searching Arrays
- NumPy - Union of Arrays
- NumPy - Finding Unique Rows
- NumPy - Creating Datetime Arrays
- NumPy - Binary Operators
- NumPy - String Functions
- NumPy - Matrix Library
- NumPy - Linear Algebra
- NumPy - Matplotlib
- NumPy - Histogram Using Matplotlib
- NumPy Sorting and Advanced Manipulation
- NumPy - Sorting Arrays
- NumPy - Sorting along an axis
- NumPy - Sorting with Fancy Indexing
- NumPy - Structured Arrays
- NumPy - Creating Structured Arrays
- NumPy - Manipulating Structured Arrays
- NumPy - Record Arrays
- Numpy - Loading Arrays
- Numpy - Saving Arrays
- NumPy - Append Values to an Array
- NumPy - Swap Columns of Array
- NumPy - Insert Axes to an Array
- NumPy Handling Missing Data
- NumPy - Handling Missing Data
- NumPy - Identifying Missing Values
- NumPy - Removing Missing Data
- NumPy - Imputing Missing Data
- NumPy Performance Optimization
- NumPy - Performance Optimization with Arrays
- NumPy - Vectorization with Arrays
- NumPy - Memory Layout of Arrays
- Numpy Linear Algebra
- NumPy - Linear Algebra
- NumPy - Matrix Library
- NumPy - Matrix Addition
- NumPy - Matrix Subtraction
- NumPy - Matrix Multiplication
- NumPy - Element-wise Matrix Operations
- NumPy - Dot Product
- NumPy - Matrix Inversion
- NumPy - Determinant Calculation
- NumPy - Eigenvalues
- NumPy - Eigenvectors
- NumPy - Singular Value Decomposition
- NumPy - Solving Linear Equations
- NumPy - Matrix Norms
- NumPy Element-wise Matrix Operations
- NumPy - Sum
- NumPy - Mean
- NumPy - Median
- NumPy - Min
- NumPy - Max
- NumPy Set Operations
- NumPy - Unique Elements
- NumPy - Intersection
- NumPy - Union
- NumPy - Difference
- NumPy Random Number Generation
- NumPy - Random Generator
- NumPy - Permutations & Shuffling
- NumPy - Uniform distribution
- NumPy - Normal distribution
- NumPy - Binomial distribution
- NumPy - Poisson distribution
- NumPy - Exponential distribution
- NumPy - Rayleigh Distribution
- NumPy - Logistic Distribution
- NumPy - Pareto Distribution
- NumPy - Visualize Distributions With Sea born
- NumPy - Matplotlib
- NumPy - Multinomial Distribution
- NumPy - Chi Square Distribution
- NumPy - Zipf Distribution
- NumPy File Input & Output
- NumPy - I/O with NumPy
- NumPy - Reading Data from Files
- NumPy - Writing Data to Files
- NumPy - File Formats Supported
- NumPy Mathematical Functions
- NumPy - Mathematical Functions
- NumPy - Trigonometric functions
- NumPy - Exponential Functions
- NumPy - Logarithmic Functions
- NumPy - Hyperbolic functions
- NumPy - Rounding functions
- NumPy Fourier Transforms
- NumPy - Discrete Fourier Transform (DFT)
- NumPy - Fast Fourier Transform (FFT)
- NumPy - Inverse Fourier Transform
- NumPy - Fourier Series and Transforms
- NumPy - Signal Processing Applications
- NumPy - Convolution
- NumPy Polynomials
- NumPy - Polynomial Representation
- NumPy - Polynomial Operations
- NumPy - Finding Roots of Polynomials
- NumPy - Evaluating Polynomials
- NumPy Statistics
- NumPy - Statistical Functions
- NumPy - Descriptive Statistics
- NumPy Datetime
- NumPy - Basics of Date and Time
- NumPy - Representing Date & Time
- NumPy - Date & Time Arithmetic
- NumPy - Indexing with Datetime
- NumPy - Time Zone Handling
- NumPy - Time Series Analysis
- NumPy - Working with Time Deltas
- NumPy - Handling Leap Seconds
- NumPy - Vectorized Operations with Datetimes
- NumPy ufunc
- NumPy - ufunc Introduction
- NumPy - Creating Universal Functions (ufunc)
- NumPy - Arithmetic Universal Function (ufunc)
- NumPy - Rounding Decimal ufunc
- NumPy - Logarithmic Universal Function (ufunc)
- NumPy - Summation Universal Function (ufunc)
- NumPy - Product Universal Function (ufunc)
- NumPy - Difference Universal Function (ufunc)
- NumPy - Finding LCM with ufunc
- NumPy - ufunc Finding GCD
- NumPy - ufunc Trigonometric
- NumPy - Hyperbolic ufunc
- NumPy - Set Operations ufunc
- NumPy Useful Resources
- NumPy - Quick Guide
- NumPy - Cheatsheet
- NumPy - Useful Resources
- NumPy - Discussion
- NumPy Compiler
NumPy - Hyperbolic Functions
NumPy Hyperbolic Functions
The hyperbolic functions are similar to trigonometric functions but are based on hyperbolas instead of circles. The most common hyperbolic functions are sinh (hyperbolic sine), cosh (hyperbolic cosine), and tanh (hyperbolic tangent).
In NumPy, there are several hyperbolic functions available to calculate these values for arrays of numbers. These functions are widely used in scenarios involving hyperbolic curves or exponential growth and decay processes.
Hyperbolic Sine Using sinh() Function
The numpy.sinh() function calculates the hyperbolic sine of each element in the input array. The hyperbolic sine is defined as −
sinh(x) = (ex - e(-x)) / 2
Example: Hyperbolic Sine
In the following example, we calculate the hyperbolic sine of an array of values using NumPy's sinh() function −
import numpy as np # Define an array of values values = np.array([0, 1, 2, 3]) # Calculate the hyperbolic sine of each element sinh_values = np.sinh(values) print("Hyperbolic Sine values:", sinh_values)
Hyperbolic Sine values: [ 0. 1.17520119 3.62686041 10.01787493]
Hyperbolic Cosine Using cosh() Function
The numpy.cosh() function calculates the hyperbolic cosine of each element in the input array. The hyperbolic cosine is defined as −
cosh(x) = (ex + e(-x)) / 2
Example: Hyperbolic Cosine
In the following example, we calculate the hyperbolic cosine of an array of values using NumPy's cosh() function −
import numpy as np # Define an array of values values = np.array([0, 1, 2, 3]) # Calculate the hyperbolic cosine of each element cosh_values = np.cosh(values) print("Hyperbolic Cosine values:", cosh_values)
This will produce the following result −
Hyperbolic Cosine values: [ 1. 1.54308063 3.76219569 10.067662 ]
Hyperbolic Tangent Using tanh() Function
The numpy.tanh() function calculates the hyperbolic tangent of each element in the input array. The hyperbolic tangent is defined as −
tanh(x) = sinh(x) / cosh(x)
Example: Hyperbolic Tangent
In the following example, we calculate the hyperbolic tangent of an array of values using NumPy's tanh() function −
import numpy as np # Define an array of values values = np.array([0, 1, 2, 3]) # Calculate the hyperbolic tangent of each element tanh_values = np.tanh(values) print("Hyperbolic Tangent values:", tanh_values)
Following is the output of the above code −
Hyperbolic Tangent values: [0. 0.76159416 0.96402758 0.99505475]
Inverse Hyperbolic Sine
The numpy.arcsinh() function calculates the inverse hyperbolic sine of each element in the input array. The inverse hyperbolic sine is defined as −
arcsinh(x) = log(x + sqrt(x2 + 1))
Example: Inverse Hyperbolic Sine
In the following example, we calculate the inverse hyperbolic sine of an array of values using NumPy's arcsinh() function −
import numpy as np # Define an array of values values = np.array([0, 1, 2, 3]) # Calculate the inverse hyperbolic sine of each element asinh_values = np.arcsinh(values) print("Inverse Hyperbolic Sine values:", asinh_values)
The output obtained is as shown below −
Inverse Hyperbolic Sine values: [0. 0.88137359 1.44363548 1.81844646]
Inverse Hyperbolic Cosine
The numpy.arccosh() function calculates the inverse hyperbolic cosine of each element in the input array. The inverse hyperbolic cosine is defined as −
arccosh(x) = log(x + sqrt(x2 - 1))
Example: Inverse Hyperbolic Cosine
In the following example, we calculate the inverse hyperbolic cosine of an array of values using NumPy's arccosh() function −
import numpy as np # Define an array of values values = np.array([1, 2, 3, 4]) # Calculate the inverse hyperbolic cosine of each element acosh_values = np.arccosh(values) print("Inverse Hyperbolic Cosine values:", acosh_values)
After executing the above code, we get the following output −
Inverse Hyperbolic Cosine values: [0. 1.3169579 1.76274717 2.06343707]
Inverse Hyperbolic Tangent
The numpy.arctanh() function calculates the inverse hyperbolic tangent of each element in the input array. The inverse hyperbolic tangent is defined as −
arctanh(x) = 0.5 * log((1 + x) / (1 - x))
Example: Inverse Hyperbolic Tangent
In the following example, we calculate the inverse hyperbolic tangent of an array of values using NumPy's arctanh() function −
import numpy as np # Define an array of values values = np.array([0, 0.5, 0.9]) # Calculate the inverse hyperbolic tangent of each element atanh_values = np.arctanh(values) print("Inverse Hyperbolic Tangent values:", atanh_values)
The result produced is as follows −
Inverse Hyperbolic Tangent values: [0. 0.54930614 1.47221949]