What is the scipy.linalg.coshm() function in Python?
Overview
Linear Algebra is a branch of mathematics that contains functions and equations useful in mathematical computations. Python’s scipy library is used for mathematical and scientific calculations. It includes the module linalg that contains linear algebra functions.
The coshm() function returns the hyperbolic cosine of a matrix.
Syntax
scipy.linalg.coshm(A)
Parameters
This function takes the parameter, A, which represents the input matrix.
Return value
This function returns another matrix containing the hyperbolic cosine of A.
Example
import numpy as npimport scipyfrom scipy.linalg import coshmA = np.matrix([[0.234,0.675],[3.456,0.987]])print(A)print('--------------------------')B = coshm(A)print(B)
Explanation
- Lines 1–2: We import the libraries,
numpyandscipy. - Line 3: We import the
linalgmodule fromscipy. - Line 5–6: We create a matrix,
A, and print it. - Line 9: We calculate the hyperbolic cosine for the matrix
A, and store it in matrixB. - Line 10: We print
B.