
- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
Get the Trigonometric sin of an angle in Python
To find the Trigonometric sine of an angle, use the numpy.sin() method in Python Numpy. The method returns the sine of each element of the 1st parameter x. The 1st parameter, x, is an Angle, in radians (2pi means 360 degrees). The 2nd and 3rd parameters are optional.
The 2nd parameter is an ndarray, 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. A tuple (possible only as a keyword argument) must have length equal to the number of outputs.
The 3rd parameter is the condition is broadcast over the input. At locations where the condition is True, the out array will be set to the ufunc result. Elsewhere, the out array will retain its original value. Note that if an uninitialized out array is created via the default out=None, locations within it where the condition is False will remain uninitialized.
Steps
At first, import the required library −
import numpy as np
Get the Trigonometric sine. Finding sin 90 degrees −
print("\nResult...",np.sin(np.pi/2.))
Finding sin 60 degrees −
print("\nResult...",np.sin(np.pi/3.))
Finding sin 45 degrees −
print("\nResult...",np.sin(np.pi/4.))
Finding sin 0 degrees −
print("\nResult...",np.sin(0))
Example
import numpy as np # To find the Trigonometric sine of an angle, use the numpy.sin() method in Python Numpy # The method returns the sine of each element of the 1st parameter x. This is a scalar if is a scalar. print("Get the Trigonometric sine...") # finding sin 90 degrees print("\nResult...",np.sin(np.pi/2.)) # finding sin 60 degrees print("\nResult...",np.sin(np.pi/3.)) # finding sin 45 degrees print("\nResult...",np.sin(np.pi/4.)) # finding sin 30 degrees print("\nResult...",np.sin(np.pi/6.)) # finding sin 0 degrees print("\nResult...",np.sin(0))
Output
Get the Trigonometric sine... Result... 1.0 Result... 0.8660254037844386 Result... 0.7071067811865475 Result... 0.49999999999999994 Result... 0.0
- Related Articles
- Get the Trigonometric cosine of an angle in Python
- Get the Trigonometric tangent of an angle in Python
- Get the Trigonometric inverse sin in Python
- Get the Trigonometric sines of an array of angles given in degrees in Python
- Get the Trigonometric inverse cosine in Python
- Get the Trigonometric inverse tangent in Python
- Get the Trigonometric cosine of an array of angles given in degrees with Python
- Get the Trigonometric tangent of an array of angles given in degrees with Python
- If \( \sin \theta=\frac{1}{\sqrt{2}} \), find all other trigonometric ratios of angle \( \theta \)
- Get the Trigonometric inverse sine of the array elements in Python
- Get the Trigonometric inverse cosine of the array elements in Python
- Get the Trigonometric inverse tangent of the array elements in Python
- Get the arc cosine of an angle in Java
- Get the arc sine of an angle in Java
- In each of the following, one of the six trigonometric ratios is given. Find the values of the other trigonometric ratios.\( \sin \theta=\frac{11}{15} \)
