Thursday, September 10, 2020

Procedure to perform various mathematical Operations on elements of arrays like addition , subtraction , multiplication , division

 Procedure to perform various mathematical Operations on elements of arrays like addition , subtraction , multiplication , division


 

   Procedure to perform various mathematical

Operations on elements of arrays like addition ,

         subtraction , multiplication , division

    ==================================

 

1) addition

import numpy as np

arr = np.array([10,20,30,40,50])

arr1 = arr + 5

print(arr1)

 

output

[15,25,35,45,55]

 

************************************

 

2) subtraction

import numpy as np

arr = np.array([10,20,30,40,50])

arr2 = arr - 5

print(arr2)

 

output

[5,15,25,35,45]

 

************************************

 

3) multiplication

import numpy as np

arr = np.array([10,20,30,40,50])

arr3 = arr - 5

print(arr3)

 

output

[50,100,150,200,250]

 

************************************

 

4) division

import numpy as np

arr = np.array([10,20,30,40,50])

arr4 = arr / 5

print(arr4)

 

output

[2,4,6,8,10]

 

 


No comments:

Post a Comment

Durga Puja in Odisha

 Durga Puja in Odisha