Created
January 10, 2019 13:45
-
-
Save deque-blog/1c92d05bfee556267d164156ac3d56eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def next_pythagorean_triples(previous): | |
matrices = np.array( | |
[[-1, 2, 2], | |
[-2, 1, 2], | |
[-2, 2, 3], | |
[1, 2, 2], | |
[2, 1, 2], | |
[2, 2, 3], | |
[1, -2, 2], | |
[2, -1, 2], | |
[2, -2, 3]]) | |
next_triples = np.transpose(matrices @ np.transpose(previous)) | |
next_triples = next_triples.reshape((3 * previous.shape[0], previous.shape[1])) | |
return next_triples |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment