From the course: NumPy Essential Training: 1 Foundations of NumPy

Unlock the full course today

Join today to access over 24,700 courses taught by industry experts.

Arithmetic operations and functions

Arithmetic operations and functions

- [Instructor] Once we have learned a set of doors for creating and manipulating NumPy arrays, let's move on to learn arithmetic operations. NumPy has a powerful capacity to apply operations on the color array instead of each element individually. This is called vectorization. When used efficiently, vectorized expressions will eliminate the need for many explicit for-loops. The benefits are: Higher performing code, less verbose code and better maintainability. There are plenty of arithmetic operations that are supported. We'll cover some of them; addition, subtraction, multiplication, division, exponentiation, and specific functions to perform them as well as some other useful functions. Let's start exploring arithmetic operations by doing some simple calculations with scalars and between arrays. We have imported NumPy as np. Now let's create a two one dimensional arrays using an arrange function. We'll call them just a and b. A will contain integers from one to 10, and b will contain…

Contents