Python3 sin() 函数

Python 3 教程 · 2019-02-05 18:11:43

描述

sin() 返回的x弧度的正弦值。

语法

以下是 sin() 方法的语法:

import math

math.sin(x)

注意:sin()是不能直接访问的,需要导入 math 模块,然后通过 math 静态对象调用该方法。

参数

  • x -- 一个数值。

返回值

返回的x弧度的正弦值,数值在 -1 到 1 之间。

实例

以下展示了使用 sin() 方法的实例:

#!/usr/bin/python3
import math

print ("sin(3) : ",  math.sin(3))
print ("sin(-3) : ",  math.sin(-3))
print ("sin(0) : ",  math.sin(0))
print ("sin(math.pi) : ",  math.sin(math.pi))
print ("sin(math.pi/2) : ",  math.sin(math.pi/2))

以上实例运行后输出结果为:

sin(3) :  0.1411200080598672
sin(-3) :  -0.1411200080598672
sin(0) :  0.0
sin(math.pi) :  1.2246467991473532e-16
sin(math.pi/2) :  1.0

点击查看所有 Python 3 教程 文章: https://www.codercto.com/courses/l/10.html

查看所有标签

Responsive Web Design

Responsive Web Design

Ethan Marcotte / Happy Cog / 2011-6 / USD 18.00

From mobile browsers to netbooks and tablets, users are visiting your sites from an increasing array of devices and browsers. Are your designs ready? Learn how to think beyond the desktop and craft be......一起来看看 《Responsive Web Design》 这本书的介绍吧!

CSS 压缩/解压工具
CSS 压缩/解压工具

在线压缩/解压 CSS 代码

MD5 加密
MD5 加密

MD5 加密工具

SHA 加密
SHA 加密

SHA 加密工具