描述
tan() 返回x弧度的正弦值。
語法
以下是 tan() 方法的語法:
import math math.tan(x)
注意:tan()是不能直接訪問的,需要導(dǎo)入 math 模塊,然后通過 math 靜態(tài)對象調(diào)用該方法。
參數(shù)
x -- 一個數(shù)值。
返回值
返回x弧度的正弦值,數(shù)值在 -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)
以上實例運(yùn)行后輸出結(jié)果為:
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
總結(jié)
以上就是本文關(guān)于Python入門之三角函數(shù)tan()函數(shù)實例詳解的全部內(nèi)容,希望對大家有所幫助。感興趣的朋友可以繼續(xù)參閱本站:Python入門之三角函數(shù)sin()函數(shù)實例詳解、Python入門之三角函數(shù)atan2()函數(shù)詳解、簡單了解Python中的幾種函數(shù)等,有什么問題可以隨時留言,小編會及時回復(fù)大家的。感謝朋友們對本站的支持!
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號聯(lián)系: 360901061
您的支持是博主寫作最大的動力,如果您喜歡我的文章,感覺我的文章對您有幫助,請用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點擊下面給點支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請將微信支付二維碼保存到相冊,切換到微信,然后點擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對您有幫助就好】元
