python numpy array calculation

Try to calculate with numpy

Array multiplication (multiplication of elements)

>>> import numpy as np
>>> from __future__ import division #For python2. Display after the decimal point
>>> my_array1 = np.array([1,2,3,4])
>>> my_array1
array([1, 2, 3, 4])
>>> my_array1*my_array1
array([ 1,  4,  9, 16])

Array subtraction

>>> my_array1-my_array1
array([0, 0, 0, 0])

Exponentiation of the array

>>> my_array1**2
array([ 1,  4,  9, 16])

Inner product of the array

>>> np.dot(my_array1,my_array1) #1*1+2*2+3*3+4*4
30

Recommended Posts

python numpy array calculation
[Python] Calculation method with numpy
Create a python numpy array
Multidimensional array calculation without Numpy
Subscript access to python numpy array
Multidimensional array calculation without Numpy Part 2
Python application: Numpy Part 3: Double array
My Numpy (Python)
Python multidimensional array
[Beginner] Python array
NumPy array manipulation (3)
#Python basics (#Numpy 1/2)
#Python basics (#Numpy 2/2)
NumPy array manipulation (1)
Python array basics
Python #Numpy basics
[Python] Numpy memo
[Scientific / technical calculation by Python] Inverse matrix calculation, numpy
Python and numpy tips
Numpy basic calculation memo
Python basics 8 numpy test
[Python] Search (NumPy) ABC165C
1. Statistics learned with Python 1-2. Calculation of various statistics (Numpy)
Age calculation using python
[Python numpy] Dynamically specify the index of the array
Date calculation in python
Calculation speed of indexing for numpy quadratic array
[Python] Sorting Numpy data
Date calculation in Python
Numerical calculation with Python
[python] Array slice operation
Python Basic --Pandas, Numpy-
[Python] Create structured array (store heterogeneous data with NumPy)
Convert NumPy array "ndarray" to lilt in Python [tolist ()]
[Tips] First-order difference calculation and inverse conversion [python / numpy]
Python / Numpy np.newaxis thinking tips
Python memo (for myself): Array
Quicksort an array in Python 3
Convert numpy int64 to python int
Empty multidimensional array in python
Shapley value calculation in Python
Python: 3D array image (numpy.array)
Implemented SMO with Python + NumPy
Matrix multiplication in python numpy
Stumble story with Python array
# 1 [python3] Simple calculation using variables
[Python] Numpy reference, extraction, combination
Python3 | Getting Started with numpy
Python 2D array trap [Copy array]
About Numpy array and asarray
[Scientific / technical calculation by Python] Basic operation of arrays, numpy
[Scientific / technical calculation by Python] Monte Carlo integration, numerical calculation, numpy
List of array (ndarray) operations of Python's numerical calculation library "Numpy"
[Scientific / technical calculation by Python] Solving simultaneous linear equations, numerical calculation, numpy
Introduction to Python Numerical Library NumPy
Python
Quantum chemistry calculation in Python (Psi4)
[Introduction to Python] <numpy ndarray> [edit: 2020/02/22]
Put python, numpy, opencv3 in ubuntu14
Accelerometer Alan Variance Calculation in Python
Self-organizing map in Python NumPy version