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 np
import scipy
from scipy.linalg import coshm
A = 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, numpy and scipy.
  • Line 3: We import the linalg module from scipy.
  • 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 matrix B.
  • Line 10: We print B.

New on Educative
Learn any Language for FREE all September 🎉
For the entire month of September, get unlimited access to our entire catalog of beginner coding resources.
🎁 G i v e a w a y
30 Days of Code
Complete Educative’s daily coding challenge every day in September, and win exciting Prizes.

Free Resources