Numpy Math Functions

 `a` Input array with degree `out` Optional , ndarray to store result `where` Optional , array with True to get values and False to leave the value

## Examples

We will use the options in our sample scripts.
``````import numpy as np
ar_deg=np.array([20,90,120,160,180]) # input array in degree
Output
``[0.34906585 1.57079633 2.0943951  2.7925268  3.14159265]``

## dtype

We will use dtype=float
``````import numpy as np
ar_deg=np.array([20,90,120,160,180])
Output
``[0.34906585 1.57079633 2.0943951  2.7925268  3.14159265]``

## where

Value to convert to radian or not we can decide by using another array filled with True and False.
``````import numpy as np
ar_deg=np.array([120,160,180])
ar_where=np.array([True,False,True])
Output
``[2.09439510e+000 7.90505033e-322 3.14159265e+000]``

## out

We can store the output in an array. We used shape() to create array (ar_out) of same shape() of our main array ar_deg.
We used ones() to create array of same shape() of our input array with degree values.
``````import numpy as np
ar_deg=np.array([120,160,180])
ar_out=np.ones(ar_deg.shape) # array created to store result
print(ar_out)
# check of both arrays are same or not
Output
``````[2.0943951  2.7925268  3.14159265]
[2.0943951  2.7925268  3.14159265]
True``````

Subscribe to our YouTube Channel here

## Subscribe

* indicates required
Subscribe to plus2net

plus2net.com