本文簡要介紹 python 語言中 numpy.lib.scimath.log2
的用法。
用法:
lib.scimath.log2(x)
計算 x 的以 2 為底的對數。
返回 “principal value”(有關此內容的說明,請參閱numpy.log2) 的 .真的x > 0, 這是一個實數 (
log2(0)
返回-inf
和log2(np.inf)
返回inf
)。否則,返回複雜的原則值。- x: array_like
對數基數為 2 的值是必需的。
- out: ndarray 或標量
x 值的以 2 為底的對數。如果 x 是標量,則輸出,否則返回數組。
參數:
返回:
注意:
對於返回的 log2()
NAN
真實的時候x < 0, 采用numpy.log2(但請注意,否則numpy.log2和這個numpy.log2是相同的,即兩者都返回-inf
為了x = 0,inf
為了x = inf, 並且, 特別是, 複雜的原則值如果x.imag != 0
)。例子:
我們設置打印精度,因此示例可以是auto-tested:
>>> np.set_printoptions(precision=4)
>>> np.emath.log2(8) 3.0 >>> np.emath.log2([-4, -8, 8]) array([2.+4.5324j, 3.+4.5324j, 3.+0.j ])
相關用法
- Python numpy scimath.log用法及代碼示例
- Python numpy scimath.logn用法及代碼示例
- Python numpy scimath.log10用法及代碼示例
- Python numpy scimath.arccos用法及代碼示例
- Python numpy scimath.arctanh用法及代碼示例
- Python numpy scimath.sqrt用法及代碼示例
- Python numpy scimath.power用法及代碼示例
- Python numpy scimath.arcsin用法及代碼示例
- Python numpy sctype2char用法及代碼示例
- Python numpy searchsorted用法及代碼示例
- Python numpy shape用法及代碼示例
- Python numpy signbit用法及代碼示例
- Python numpy setdiff1d用法及代碼示例
- Python numpy seterr用法及代碼示例
- Python numpy sort用法及代碼示例
- Python numpy square用法及代碼示例
- Python numpy std用法及代碼示例
- Python numpy sum用法及代碼示例
- Python numpy spacing用法及代碼示例
- Python numpy seterrobj用法及代碼示例
- Python numpy squeeze用法及代碼示例
- Python numpy shares_memory用法及代碼示例
- Python numpy s_用法及代碼示例
- Python numpy swapaxes用法及代碼示例
- Python numpy show_config用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.lib.scimath.log2。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。