Python入門之三角函式atan2 函式詳解

2022-09-29 18:27:10 字數 829 閱讀 5131

描述

atan2() 返回給定的 x 及 y 座標值的反正切值。

語法以下是 atan2() 方法的語法:

import math

math.atan2(y, x)

注意:atan2()是不能直接訪問的,需要匯入 math 模組,然後通過 math 靜態物件呼叫該方法。

引數x -- 乙個數值。

y -- 乙個數值。

返回值程式設計客棧

返回給定的 x 及 y 座標值的反正切值。

例項以下展示了使用 atan2() 方法的例項:

#!/usr/bin/python

import math

print "atan2(-0.50,-0.50) : ", math.atan2(-0.50,-0.50)

print "atan2(0.50,0.50) : ", math.atan2(0.50,0.50)

print "atan2(5,5) : ", math.atan2(5,5)

print "atan2(-10,10) : ", math.atan2(-10,10)

print "atan2(10,20) : ", math.atan2(10,20)

以上例項執行後輸出結果為:

atan2(-0.50,-0.50) : -2.35619449019

atan2(0.50,0.50) : 0.785398163397

atan2(5,5) : 0.785398163397

atan2(-10,10) : -0.785398163397

atan2(10,20) : 0.463647609001

總結

Python入門之三角函式sin 函式例項詳解

描述 sin 返回的x弧度的正弦值。語法以下是sin 方法的itoca語法 importmath maitocath.sin x 注意 sin 是不能直接訪問的,需要匯入math模組,然後通過math靜態物件呼叫該方法。引數x 乙個數值。返回值返回的x弧度的正弦值,數值在 1到1之間。例項以下展示了...

常見三角函式與反三角函式

16341019 資料科學與計算機學院 toc 三角函式公式 反三角函式公式 簡單函式影象 1三角函式公式 兩角和公式 sin a b sinacosb cosasinb sin a b sinacosb cosasinb cos a b cosacosb sinasinb cos a b cosa...

常見三角函式與反三角函式

16341019 資料科學與計算機學院 toc 三角函式公式 反三角函式公式 簡單函式影象 1三角函式公式 兩角和公式 sin a b sinacosb cosasinb sin a b sinacosb cosasinb cos a b cosacosb sinasinb cos a b cosa...