Phương thức Python math.sin()
Ví dụ
Tìm sin của các số khác nhau:
# Import math Library
import math
# Return the sine of different
values
print (math.sin(0.00))
print (math.sin(-1.23))
print (math.sin(10))
print (math.sin(math.pi))
print
(math.sin(math.pi/2))
Hãy tự mình thử »Định nghĩa và cách sử dụng
Phương thức math.sin()
trả về sin của một số.
Lưu ý: Để tìm sin độ, trước tiên nó phải được chuyển đổi thành radian bằng phương thức math.radians()
(xem ví dụ bên dưới).
Cú pháp
math.sin( x )
Giá trị tham số
Parameter | Description |
---|---|
x | Required. The number to find the sine of. If the value is not a number, it returns a TypeError |
Chi tiết kỹ thuật
Giá trị trả về: | Giá trị float , từ -1 đến 1, biểu thị sin của một góc |
---|---|
Phiên bản Python: | 1.4 |
Thêm ví dụ
Ví dụ
Tìm sin có bậc khác nhau:
# Import math Library
import math
# Return the sine value of 30
degrees
print(math.sin(math.radians(30)))
# Return the sine value
of 90 degrees
print(math.sin(math.radians(90)))
Hãy tự mình thử »