Perform the following Elementary Mathematical Functions using Numpy Array. array1 = np.array([[10, 20, 30], [40, 50, 60]]). Data science using Python in Anaconda - Jupyter

 Question

1. sin(array1)

2. cos(array1)

3. tan(array1)

4. sqrt(array1)

5. exp(array1)

6. log10(array1)


Program: -

import numpy as np
array1 = np.array([[102030], [405060]])
print("Orignal Array 1:- \n",array1,"\n")
print("Sin :- \n",np.sin(array1))
print("Cos :- \n",np.cos(array1))
print("Tan :- \n",np.tan(array1))
print("Sqrt :- \n",np.sqrt(array1))
print("Exp :- \n",np.exp(array1))
print("log :- \n",np.log10(array1))


Output: -
Orignal Array 1:- [[10 20 30] [40 50 60]] Sin :- [[-0.54402111 0.91294525 -0.98803162] [ 0.74511316 -0.26237485 -0.30481062]] Cos :- [[-0.83907153 0.40808206 0.15425145] [-0.66693806 0.96496603 -0.95241298]] Tan :- [[ 0.64836083 2.23716094 -6.4053312 ] [-1.11721493 -0.27190061 0.32004039]] Sqrt :- [[3.16227766 4.47213595 5.47722558] [6.32455532 7.07106781 7.74596669]] Exp :- [[2.20264658e+04 4.85165195e+08 1.06864746e+13] [2.35385267e+17 5.18470553e+21 1.14200739e+26]] log :- [[1. 1.30103 1.47712125] [1.60205999 1.69897 1.77815125]]