Facebook Page Twitter Page LinkedIn Page
× NumPy Tutorial NumPy Resources

The NumPy sin() function is used to calculate trigonometric sine of given angle in radians.


numpy.sin(x, out=None)


x Required. Specify array (array_like) containing elements as angles in radians of which the trigonometric sine is calculated.
out Optional. Specify a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

Return Value

Returns the sine of each element of x.


In the example below, numpy sin() function is used to calculate the sine of each element present in array Arr.

import numpy as np

Arr = np.array([0, 30, 60, 90])
#converting the angles in radians
Arr = Arr*np.pi/180

print("The sin value of angles:")

The output of the above code will be:

The sin value of angles:
[ 0.         0.5        0.8660254  1.       ]

❮ NumPy - Functions