Numpy's Universal Functions
1. UFUNC BASICS
1.1. Arithmetics
import numpy as np
# creating an array first, using arange
arr = np.arange(1,11)
print(f"Array on which to perform ufunc: \n{arr}")
# addition
print(f"array + 1 is:\n{arr+1}")
# subtration
print(f"array - 1 is:\n{arr-1}")
# multiplication
print(f"array * 5 is:\n{arr*5}")
# division
print(f"array / 2 is:\n{arr/5}")
# negative * array
print(f"-array is:\n{-arr}")
# square
print(f"array sqaure is:\n{arr**2}")
# modulus operator
print(f"array % is:\n{arr%2}")1.2. Trigonometric Functions
1.3. Statistics Functions
1.4. Log and Exponent
2. BEYOND BASIC UFUNC
2.1. Specifying output
2.2. Reduce
a. 1D
b. 2D
2.3. Accumulate
a. 1D
b. 2D
2.4. Outer products
Last updated