Numpy Study Notes (1)

Source: Internet
Author: User


1. Random. Rand (n, n)

Generate a random array of n × n

2. Mat (random. Rand (n, n ))

The mat method can convert an array into a matrix.

3. Mat. I

Calculate the inverse matrix of the matrix mat

4. Eye (4, 4)

Generate n × n unit matrix

# First. pyfrom numpy import * # Build 4x4 Rand matrixprint random. rand (4, 4) print '=============== 'randmat = MAT (random. rand (4, 4) # randmat. I randmatprint 'randmat: 'print randmatprint 'randmat. i: 'print randmat. I # randmat. I solve the inverse of a matrixmyeye = randmat * randmat. iPrint myeye # Eye function create an identity matrix of nprint eye (4, 4)


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.