本文簡要介紹 python 語言中 numpy.lib.scimath.power
的用法。
用法:
lib.scimath.power(x, p)
返回 x 的 p 次冪,(x**p)。
如果 x 包含負值,則將輸出轉換為複域。
- x: array_like
輸入值。
- p: 數組 整數
所擁有的權力x被提出。如果x包含多個值,p必須是標量,或者包含與x。在後一種情況下,結果是
x[0]**p[0], x[1]**p[1], ...
.
- out: ndarray 或標量
的結果
x**p
.如果x和p是標量,所以是out,否則返回一個數組。
參數:
返回:
例子:
>>> np.set_printoptions(precision=4)
>>> np.emath.power([2, 4], 2) array([ 4, 16]) >>> np.emath.power([2, 4], -2) array([0.25 , 0.0625]) >>> np.emath.power([-2, 4], 2) array([ 4.-0.j, 16.+0.j])
相關用法
- Python numpy scimath.log用法及代碼示例
- Python numpy scimath.logn用法及代碼示例
- Python numpy scimath.log2用法及代碼示例
- Python numpy scimath.arccos用法及代碼示例
- Python numpy scimath.log10用法及代碼示例
- Python numpy scimath.arctanh用法及代碼示例
- Python numpy scimath.sqrt用法及代碼示例
- 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.power。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。