numpy.linalg.eig() Method in Python Last Updated : 10 Aug, 2020 Comments Improve Suggest changes Like Article Like Report In NumPy we can compute the eigenvalues and right eigenvectors of a given square array with the help of numpy.linalg.eig(). It will take a square array as a parameter and it will return two values first one is eigenvalues of the array and second is the right eigenvectors of a given square array. Syntax: numpy.linalg.eig() Parameter: An square array. Return: It will return two values first is eigenvalues and second is eigenvectors. Example 1: Python import numpy as np mat = np.mat("1 -2;1 3") # Original matrix print(mat) print("") evalue, evect = np.linalg.eig(mat) # Eigenvalues of the said matrix" print(evalue) print("") # Eigenvectors of the said matrix print(evect) Output: [[ 1 -2] [ 1 3]] [2.+1.j 2.-1.j] [[ 0.81649658+0.j 0.81649658-0.j ] [-0.40824829-0.40824829j -0.40824829+0.40824829j]] Example 2: Python import numpy as np mat = np.mat("1 2 3;1 3 4;3 2 1") # Original matrix print(mat) print("") evalue, evect = np.linalg.eig(mat) # Eigenvalues of the said matrix" print(evalue) print("") # Eigenvectors of the said matrix print(evect) Output: [[1 2 3] [1 3 4] [3 2 1]] [ 6.70156212 0.29843788 -2. ] [[-0.5113361 -0.42932334 -0.40482045] [-0.69070311 0.7945835 -0.52048344] [-0.5113361 -0.42932334 0.75180941]] Comment More infoAdvertise with us Next Article numpy.linalg.eig() Method in Python vipinyadav15799 Follow Improve Article Tags : Python Python-numpy Python numpy-Matrix Function Practice Tags : python Similar Reads Python | Numpy np.eigvals() method With the help of np.eigvals() method, we can get the eigen values of a matrix by using np.eigvals() method. Syntax : np.eigvals(matrix) Return : Return the eigen values of a matrix. Example #1 : In this example we can see that by using np.eigvals() method, we are able to get the eigen values of a ma 1 min read numpy.ma.ediff1d() function in Python numpy.ma.ediff1d() function return the differences between consecutive elements of an array. Syntax : numpy.ma.ediff1d(arr, to_end = None, to_begin = None) Parameters : arr : [array_like] Input array. to_end : [array_like, optional] Number to append at the end of the returned differences. to_begin 1 min read numpy.ceil() in Python The numpy.ceil() is a mathematical function that returns the ceil of the elements of array. The ceil of the scalar x is the smallest integer i, such that i >= x Syntax : numpy.ceil(x[, out]) = ufunc âceilâ) Parameters : a : [array_like] Input array Return : The ceil of each element with float dat 2 min read numpy.ldexp() in Python In Python, numpy.ldexp(arr1, arr2[, out]) function returns arr1 * (2**arr2), element-wise. This is also called as inverse of numpy.frexp() function. Syntax: numpy.ldexp()Parameters: arr1: [array_like] Array of multipliers. arr2: [array_like, int] Array of twos exponents. out: [ndarray, optional] Out 1 min read Python | sympy.eigenvals() method With the help of sympy.eigenvals() method, we can find the eigenvalues of a matrix by using sympy.eigenvals() method. Syntax : sympy.eigenvals() Return : Return eigenvalues of a matrix. Example #1 : In this example, we can see that by using sympy.eigenvals() method, we are able to find the eigenvalu 1 min read numpy.eye() in Python numpy.eye() is a function in the NumPy library that creates a 2D array with ones on the diagonal and zeros elsewhere. This function is often used to generate identity matrices with ones along the diagonal and zeros in all other positions.Let's understand with the help of an example:Pythonimport nump 2 min read Python PyTorch linalg.svd() method PyTorch linalg.svd() method computes the singular value decomposition (SVD) of a matrix. 2D tensors are matrices in PyTorch. This method supports both real and complex-valued matrices (float, double, cfloat, and cdouble dtypes).  It takes input a matrix or a batch of matrices and returns decompositi 4 min read numpy.exp() in Python numpy.exp(array, out = None, where = True, casting = 'same_kind', order = 'K', dtype = None) : This mathematical function helps user to calculate exponential of all the elements in the input array. Parameters : array : [array_like]Input array or object whose elements, we need to test. out : [ndarray 4 min read numpy.imag() function - Python numpy.imag() function return the imaginary part of the complex argument. Syntax : numpy.imag(arr) Parameters : arr : [array_like] Input array. Return : [ndarray or scalar] The imaginary component of the complex argument. If val is real, the type of val is used for the output. If val has complex elem 1 min read numpy.expm1() in Python numpy.expm1(array, out = None, where = True, casting = 'same_kind', order = 'K', dtype = None) : This mathematical function helps user to calculate exponential of all the elements subtracting 1 from all the input array elements. Parameters : array : [array_like]Input array or object whose elements, 2 min read Like