Python入门之三角函数tan()函数实例详解
作者:mengwei 时间:2022-04-12 18:41:59
描述
tan() 返回x弧度的正弦值。
语法
以下是 tan() 方法的语法:
import math
math.tan(x)
注意:tan()是不能直接访问的,需要导入 math 模块,然后通过 math 静态对象调用该方法。
参数
x -- 一个数值。
返回值
返回x弧度的正弦值,数值在 -1 到 1 之间。
实例
以下展示了使用 tan() 方法的实例:
#!/usr/bin/python
import math
print "tan(3) : ", math.tan(3)
print "tan(-3) : ", math.tan(-3)
print "tan(0) : ", math.tan(0)
print "tan(math.pi) : ", math.tan(math.pi)
print "tan(math.pi/2) : ", math.tan(math.pi/2)
print "tan(math.pi/4) : ", math.tan(math.pi/4)
以上实例运行后输出结果为:
tan(3) : -0.142546543074
tan(-3) : 0.142546543074
tan(0) : 0.0
tan(math.pi) : -1.22460635382e-16
tan(math.pi/2) : 1.63317787284e+16
tan(math.pi/4) : 1.0
来源:http://www.runoob.com/python/func-number-tan.html
标签:python,函数
0
投稿
猜你喜欢
Asp编写不再让人讨厌的自动弹出窗口
2007-09-29 12:16:00
分享整理的12条sql语句连同数据
2012-07-11 16:14:59
GoLang使goroutine停止的五种方法实例
2023-09-02 08:31:33
asp 网站静态化函数代码html
2011-03-16 11:21:00
Asp 操作Cookies(包括设置[赋值]、读取、删除[设置过期时间])
2011-03-10 11:06:00
asp动态页面防采集的新方法
2011-02-26 10:44:00
linux下默认安装mysql数据库
2011-03-08 09:24:00
如何获取浏览器的更多信息?
2009-11-23 20:48:00
python入门:这篇文章带你直接学会python
2021-04-15 04:46:42
Django使用Mysql数据库已经存在的数据表方法
2023-07-21 15:24:59
PHP异常Parse error: syntax error, unexpected T_VAR错误解决方法
2023-11-16 13:00:48
MySQL Order By Rand()效率
2011-01-04 19:34:00
有关JS中Event对象的几点总结
2009-03-06 12:36:00
javascript 版 Bad Apple 字符动画
2010-01-28 12:19:00
js表单提交显示进度条
2007-09-18 13:10:00
MySQL鲜为人知的几个特殊技巧
2009-03-09 13:22:00
自己写的一个PJBlog中可以双击输入验证码的修改
2009-05-17 10:51:00
浅谈购物类网站如何保持视觉设计的一致性
2009-03-30 16:02:00
js常用排序实现代码
2023-08-30 08:50:24
Laravel实现登录跳转功能
2023-06-14 23:35:40