NumPy Array Math Perform arithmetic and mathematical operations efficiently on NumPy arrays. Array Math Operations Element- wise Operations NumPy operations are vectorized - they operate on all array elements at once Much faster than Python loops for large datasets Supports all standard arithmetic operators: + , - , * , / , ** (power), // (floor division) Mathematical Functions Universal functions ( ufuncs ) for element-wise operations Trigonometric: sin , cos , tan Exponential: exp , log , log10 Statistical: sum , mean , std , min , max Linear algebra functions through np.linalg module import numpy as np # Basic arithmetic operations a = np.array([ 1 , 2 , 3 ]) b = np.array([ 4 , 5 , 6 ]) print ( 'Addition:' , a + b) print ( 'Subtraction:' , b - a) print ( 'Multiplication:' , a * print ( 'Division:' , b / a) # [5 7 9] # [3 3 3] b) # [4 10 18] # [4. 2.5 2.] # Advanced mathematical functions print ( 'Square root:' , np.sqrt(a)) print ( 'Exponential:' , np.exp(a)) print ( 'Sine:' , np.sin(a)) # Aggregation operations print ( 'Sum:' , np.sum(b)) print ( 'Mean:' , np.mean(b)) print ( 'Standard deviation:' , # 15 # 5.0 np.std(b)) Also includes % (modulo) and bit- wise operations Made with Genspark Page 7 Python Data Science Complete Guide