Numpy 的 gcd(~)
方法計算給定值的最大公約數。
參數
1. x1
| array-like
首先輸入數字。
2. x2
| array-like
第二個輸入數字。
返回值
一個 Numpy 數組,保存給定值的最大公約數。如果 x1
和 x2
是標量,則返回類型也將是標量。
例子
np.gcd(12, 20)
4
要計算 (12,20)
和 (15,45)
的最大公約數:
np.gcd([12, 15], [20, 45])
array([ 4, 15])
相關用法
- Python gcd()用法及代碼示例
- Python gc.is_finalized用法及代碼示例
- Python gc.is_tracked用法及代碼示例
- Python Django get_language_info用法及代碼示例
- Python Pandas get_dummies方法用法及代碼示例
- Python PIL getbands() and getextrema()用法及代碼示例
- Python PIL getpixel()用法及代碼示例
- Python Tableau groups.update用法及代碼示例
- Python NumPy genfromtxt方法用法及代碼示例
- Python getattr()用法及代碼示例
- Python OpenCV getTrackbarPos()用法及代碼示例
- Python Django get用法及代碼示例
- Python NumPy get_printoptions方法用法及代碼示例
- Python OpenCV getgaussiankernel()用法及代碼示例
- Python gzip.compress(s)用法及代碼示例
- Python globals()用法及代碼示例
- Python OpenCV getRotationMatrix2D()用法及代碼示例
- Python Django get_messages用法及代碼示例
- Python Tableau groups.delete用法及代碼示例
- Python Tableau groups.create用法及代碼示例
- Python numpy string greater_equal()用法及代碼示例
- Python Tableau groups.remove_user用法及代碼示例
- Python Tableau groups.populate_users用法及代碼示例
- Python PIL getbands()用法及代碼示例
- Python Tableau groups.get用法及代碼示例
注:本文由純淨天空篩選整理自Isshin Inada大神的英文原創作品 NumPy | gcd method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。