Instantly share code, notes, and snippets.

# Francis, LeeFrancis-Lee-Earth

• Earth
Block or report user

### Report or block Francis-Lee-Earth

Hide content and notifications from this user.

• Sort options
Last active Oct 11, 2018
Modular Multiplicative Inverse
View ModularMultiplicativeInverse.py
 def greatest_common_divisor_extended(a, b): ''' 擴展歐幾里得算法 (Extended Euclidean algorithm) ''' if b == 0: return a, 1, 0 gcd, y, x = greatest_common_divisor_extended(b, a % b) return gcd, x, y - (a // b) * x
Last active Oct 11, 2018
Greatest Common Divisor (GCD)
View GreatestCommonDivisor.py
 def greatest_common_divisor(a, b): """ 除非 b == 0，否則結果將與 b 具有相同的正負號 (因此，當 b 除以它，結果是正號) """ while b > 0: a, b = b, a % b return a
Created Oct 11, 2018
Matrix Inverse
View MatrixInverse.py
 import numpy as np a = np.array([ [1, -2, -1], [2, -1, 1], [3, -6, -5] ]) a_inv = np.linalg.inv(a) print("A:")
Created Oct 11, 2018
Matrix
View Matrix.py
 import numpy as np a = np.array([ [5, 12], [15, 25] ]) b = np.array( [20, 10] )
You can’t perform that action at this time.