首页 > Python资料 博客日记

Python数字tan()方法

2023-08-02 16:46:24Python资料围观189

文章Python数字tan()方法分享给大家,欢迎收藏Python资料网,专注分享技术知识

Python数字tan()方法返回x弧度的切线。

语法

以下是tan()方法的语法 -

tan(x)

注意 - 此函数不能直接访问,需要导入math模块,需要使用math静态对象调用此函数。

参数

  • x - 此参数必须是数字值。

返回值

  • 此方法返回-11之间的数值,表示参数x的切线。

示例

以下示例显示了tan()方法的用法。

#!/usr/bin/python3
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))

当运行上述程序时,它会产生以下结果 -

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))

版权声明:本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:jacktools123@163.com进行投诉反馈,一经查实,立即删除!

标签:

相关文章

本站推荐