Python 中的 tan(x)函数

首页 / Python2入门教程 / Python 中的 tan(x)函数

Python tan()返回x弧度的正切。

tan(x) - 语法

tan(x)
  • x  -  必须是数值。

tan(x) - 返回值

此方法返回一个介于-1和1之间的数值,表示参数x的正切。

无涯教程网

tan(x) - 示例

以下示例显示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)

当无涯教程运行上面的程序时,它产生以下结果-

链接:https://www.learnfk.comhttps://www.learnfk.com/python/number-tan.html

来源:LearnFk无涯教程网

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

祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)

技术教程推荐

如何设计一个秒杀系统 -〔许令波〕

.NET Core开发实战 -〔肖伟宇〕

架构实战案例解析 -〔王庆友〕

职场求生攻略 -〔臧萌〕

大厂晋升指南 -〔李运华〕

跟着高手学复盘 -〔张鹏〕

徐昊 · TDD项目实战70讲 -〔徐昊〕

Serverless进阶实战课 -〔静远〕

结构学习力 -〔李忠秋〕

好记忆不如烂笔头。留下您的足迹吧 :)