Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mathematical Operation method of NumPy Array

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "the mathematical operation of NumPy array". Interested friends may wish to have a look at it. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn the mathematical operation of NumPy array.

Background introduction

Today, we learn to use numpy's built-in mathematical operation method and the basic arithmetic operator to learn the mathematical operation of the array, which involves the basic operation knowledge of the vector matrix of linear algebra (unfamiliar children's shoes will repair it later). Let's start with:

Getting started exampl

The following is the execution process in Jupyter Notebook:

The code is as follows:

# using the numpy array for mathematical operations import numpy as npx = np.array ([[1pjue 2], [3pr 4]]) y = np.array ([[5pc6], [7pc8]]) # addition # using the operator array addition x + y # using the np.add () method to add z = np.add (x) z # subtraction x-ynp.subtract (x Y) # multiplication operation x * ynp.multiply (XMague y) # Division operation x / ynp.divide (XMague y) # take the square root np.sqrt (x) v = np.array ([9LJ 10]) w = np.array ([11LJ 13]) # use np.dot () for matrix operation # his function returns the dot product of two arrays. For a two-dimensional vector, it is equivalent to matrix multiplication. # for 1Mel D array, it is the inner product of the vector. For an N-dimensional array, it is the product of the last axis of an and the penultimate axis of b. V.dot (w) # is equivalent to (9: 11) + (10: 13) np.dot (vMagne w) np.dot (XMague y) # the array transposed xx.Tnp.sum (x) # 1+3+2+4np.sum (xmeme axisym0) # line phase plus result np.sum (xPoweraxishui 1) # column to add the result, I believe you have a deeper understanding of the "mathematical operation method of NumPy array", might as well come to the actual operation! Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report