NumPy Tutorial NumPy Statistics NumPy References

NumPy - cosh() function



The NumPy cosh() function is used to calculate hyperbolic cosine of a value. The hyperbolic cosine of x is defined as:

cosh

where e is an Euler's number.

Syntax

numpy.cosh(a, out=None)

Parameters

a Required. Specify array (array_like) containing elements, of which the hyperbolic cosine is calculated.
out Optional. Specify a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

Return Value

Returns the hyperbolic cosine of each element in a.

Example:

In the example below, numpy cosh() function is used to calculate the hyperbolic cosine of each element present in array Arr.

import numpy as np

Arr = np.array([1, 2, 3, 4])

print("The hyperbolic cosine of values:")
print(np.cosh(Arr))

The output of the above code will be:

The hyperbolic cosine of values:
[  1.54308063   3.76219569  10.067662    27.30823284]

❮ NumPy - Functions

5