Differences between matrices and arrays

Source: Internet
Author: User

The elements in the array can be characters, etc.
Only the number in a matrix
This is the most intuitive difference between the two.
Because the matrix is a mathematical concept (in linear algebra), an array is a concept on a computer.
Have you ever seen the concept of arrays in pure mathematics? No.
Because knowledge of linear algebra is commonly used on computers (in the accurate sense of information science), the concept of matrices is referenced.

"Proficient in MATLAB6.5 version" (Zhang Zhijian, Beijing University of Aeronautics and Astronautics Press) said: "From the appearance of shape and data structure, two-dimensional array and the matrix in mathematics is not different." However, as the embodiment of a transformation or mapping operator, matrix operation has definite and strict mathematical rules. and the array element is the MATLAB software defines the rule, its purpose is for the data management convenience, the operation is simple, the instruction form natural and the execution computation effective. Although the array operation lacks the rigorous mathematical reasoning, although the array operation is still perfect and mature, its effect and influence are expanding with the development of MATLAB. Array operations: number and array plus minus: K+/-a        %k plus or minus a for each element array multiplier group:   a.*b          % corresponding element Phase multiplier Group: A.^k         %a each element k-th Square K.^a, each element of the base a of K is the exponent of the exponential power value divided by the array:   k./a and a./k   %k respectively by the element of a divisor division:     left except a . \b Right except b./a, corresponding element division matrix operation: number and matrix plus minus:k+/-a              % is equivalent to K*ones (size (A)) +/-a matrix multiplication:    a*b                % matrix multiplication rule matrix by mathematical definition: a^k                %k matrix A multiplication matrix division:     left a\b right except b/a     % are ax=b and xa=b, respectively.The solution is visible, and the operation of the array is simple. A matrix is a two-dimensional version of an array, regardless of mathematical significance. Constructs an array: 1, directly constructs: x=[1,2,3,4,5,6]2, increment method constructs with the space or the comma interval array element: Uses the colon operator to create the array a=first:end          % increment, and an array of step 1 a=first:step:end     % Specify the increment step value to create any linear sequence 3, constructed with Linspace function x= Linspace (first,last,num)   % need to specify the sum of the values and the total number of elements, the step size according to the average allocation of NUM constructs the Matrix 1, the simple creation method uses [], the comma or the empty open each element, the semicolon separates each line, the note each row has the same element number. 2, the difference between the structure of special matrix Ones,zeros,eye,diag,magic,rand,randn,randpem.....  numpy Matrix and array

Matrices Matrix and array arrays are two data types in NumPy that can be used to manipulate the number elements represented by rows and columns.

1. The matrix can only be 2-dimensional, and an array may be any number of dimensions.

Random Initialization instance:

 

2. Performing the same mathematical operation on both data types results in a different result

For a, B, two matrices,a*b represent matrix product

 


For array, a*b means multiplying elements by element

The * * operator represents a different meaning, and for Maxtrix, a**2 represents a*a


For array, a**2 represents the square of the number in the array

 

Differences between matrices and arrays

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.