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

2022-09-29 18:27:11 字數 703 閱讀 7846

描述

sin()返回的x弧度的正弦值。

語法以下是sin()方法的itoca語法:

importmath

maitocath.sin(x)

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

引數x--乙個數值。

返回值返回的x弧度的正弦值,數值在-1到1之間。

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

#!/usr/bin/python

import math

print "sin(3) : ", math.sin(3)

print "sin(-3) : ", math.sin(-3)

print "sin(0) : ", math.sin(0)

print "sin(math.itocapi) : ", math.sin(math.pi)

print "sin(math.pi/2) : ", math.sin(math.pi/2)

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

sin(3) : 0.14112000806

sin(-3) : -0.141www.cppcns.com12000806

sin(0) : 0.0

sin(math.pi) : 1.22460程式設計客棧635382e-16

sin(math.pi/2) : 1

總結

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

描述 atan2 返回給定的 x 及 y 座標值的反正切值。語法以下是 atan2 方法的語法 import math math.atan2 y,x 注意 atan2 是不能直接訪問的,需要匯入 math 模組,然後通過 math 靜態物件呼叫該方法。引數x 乙個數值。y 乙個數值。返回值程式設計客...

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

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