Share on:

#### Python NumPy For Your Grandma | Section 2.5 | Basic Math

##### December 29, 2019
python courses

This video covers basic math operations for NumPy arrays like addition, subtraction, multiplication, division, and matrix multiplication.

# Code

import numpy as np

# make 2x2 arrays
foo = np.array([[4,3], [1,0]])
bar = np.array([[1,2], [3,4]])

foo + bar

# subtraction
foo - bar

# multiplication
foo * bar

# division
foo / bar

# matrix multiplication, you can use the @ operator
foo @ bar

# Transcript

Now let’s see some basic math operations using these 2x2 arrays. With numpy, you can