Input arrays for performing arithmetic operations such as add(), subtract(), multiply(), and divide() must be either of the same shape or should conform to array broadcasting rules.

In [1]:

```
import numpy as np
a = np.arange(9, dtype = np.float_).reshape(3,3)
```

In [3]:

```
print ('First array:')
print (a)
print ('\n')
```

In [4]:

```
print ('Second array:')
b = np.array([10,10,10])
print (b)
print ('\n')
```

In [6]:

```
print ('Add the two arrays:')
print (np.add(a,b))
print ('\n')
```

In [7]:

```
print ('Subtract the two arrays:')
print (np.subtract(a,b))
print ('\n')
```

In [8]:

```
print ('Multiply the two arrays:')
print (np.multiply(a,b))
print ('\n')
```

In [9]:

```
print ('Divide the two arrays:')
print (np.divide(a,b))
```

This function returns the reciprocal of argument, element-wise. For elements with absolute values larger than 1, the result is always 0 because of the way in which Python handles integer division. For integer 0, an overflow warning is issued.

In [13]:

```
import numpy as np
a = np.array([0.25, 1.33, 1, 33, 100])
print ('Our array is:')
print (a)
print ('\n')
print ('After applying reciprocal function:')
print (np.reciprocal(a))
print ('\n')
b = np.array([100], dtype = int)
print ('The second array is:')
print (b)
print ('\n')
```

This function treats elements in the first input array as base and returns it raised to the power of the corresponding element in the second input array.

In [14]:

```
import numpy as np
a = np.array([10,100,1000])
print ('Our array is:')
print (a)
print ('\n')
print ('Applying power function:')
print (np.power(a,2))
print ('\n')
print ('Second array:')
b = np.array([1,2,3])
print (b)
print ('\n')
print ('Applying power function again:')
print (np.power(a,b))
```

This function returns the remainder of division of the corresponding elements in the input array. The function numpy.remainder() also produces the same result.

In [15]:

```
import numpy as np
a = np.array([10,20,30])
b = np.array([3,5,7])
print ('First array:')
print (a)
print ('\n')
print ('Second array:')
print (b)
print ('\n')
print ('Applying mod() function:')
print (np.mod(a,b))
print ('\n')
print ('Applying remainder() function:')
print (np.remainder(a,b))
```

The following functions are used to perform operations on array with complex numbers.

**numpy.real()**− returns the real part of the complex data type argument.**numpy.imag()**− returns the imaginary part of the complex data type argument.**numpy.conj()**− returns the complex conjugate, which is obtained by changing the sign of the imaginary part.**numpy.angle()**− returns the angle of the complex argument. The function has degree parameter. If true, the angle in the degree is returned, otherwise the angle is in radians.

In [32]:

```
import numpy as np
a = np.array([-5.6j, 0.2j, 11. , 1+1j])
```

In [33]:

```
print ('Our array is:')
print (a)
```

In [26]:

```
print ('Applying real() function:')
print (np.real(a))
```

In [27]:

```
print ('Applying imag() function:')
print (np.imag(a))
```

In [28]:

```
print ('Applying conj() function:')
print (np.conj(a))
```

In [29]:

```
print ('Applying angle() function:')
print (np.angle(a))
```

In [30]:

```
print ('Applying angle() function again (result in degrees)')
print (np.angle(a, deg = True))
```

**Thank You** for visiting our website. If you like our work, please support us so that we can keep on creating new tutorials/blogs on interesting topics (like AI, ML, Data Science, Python, Digital Marketing, SEO, etc.) that can help people learn new things faster. You can support us by clicking on the **Coffee** button at the bottom right corner. We would appreciate even if you can give a thumbs-up to our article in the comments section below.

If you want to

- provide some suggestions on topic
- share your views
- include some details in tutorial
- suggest some new topics on which we should create tutorials/blogs