NumPy the determinant of an array in Python Numpy.linalg.det ()

Source: Internet
Author: User

Numpy.linalg.det

numpy.linalg.det(a)[source]

Computes the determinant of any array a, but this requires that the last two dimensions of the array must be square.

Parameters:

a : (....., M, m) array_like

Input array to compute determinants for.

Return:

det : (...) Array_like

Determinant of a.

For example:

1>>>a=np.reshape (Np.arange (6), (2,3))2>>>a3Out:array ([[[0, 1, 2],4[3, 4, 5]])5>>>Np.linalg.det (a)6Out:LinAlgError:Last 2dimensions of the array must be square7 8>>>a=np.reshape (Np.arange (20), (5,2,2))9>>>aTenOut:array ([[[[[0], 1], One[2, 3]], A  -[[4, 5], -[6, 7]], the  -[[8, 9], -[10, 11]], -  +[[12, 13], -[14, 15]], +  A[[16, 17], at[18, 19]]]) -  ->>>Np.linalg.det (a) -Out:array ([-2.,-2.,-2.,-2.,-2.])

In fact, this function is to calculate the determinant value of a square matrix.

NumPy the determinant of an array in Python Numpy.linalg.det ()

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.