Heim  >  Artikel  >  Backend-Entwicklung  >  用Python计算三角函数之atan()方法的使用

用Python计算三角函数之atan()方法的使用

WBOY
WBOYOriginal
2016-06-10 15:12:301822Durchsuche

 atan()方法返回x的反正切值,以弧度表示。
Syntax

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

atan(x)

注意:此函数是无法直接访问的,所以我们需要导入math模块,然后需要用math的静态对象来调用这个函数。
参数

  •     x -- 这必须是一个数值。

返回值

此方法返回 x 的反正切值,以弧度表示。
例子

下面的例子显示atan()方法的使用。

#!/usr/bin/python
import math

print "atan(0.64) : ", math.atan(0.64)
print "atan(0) : ", math.atan(0)
print "atan(10) : ", math.atan(10)
print "atan(-1) : ", math.atan(-1)
print "atan(1) : ", math.atan(1)

当我们运行上面的程序,它会产生以下结果:

atan(0.64) : 0.569313191101
atan(0) : 0.0
atan(10) : 1.4711276743
atan(-1) : -0.785398163397
atan(1) : 0.785398163397

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn