Created
January 18, 2016 20:23
-
-
Save gidden/c0c319fa19cc84da1431 to your computer and use it in GitHub Desktop.
sum of squares
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
| # given an array of data called x: | |
| import numpy as np | |
| sum_of_squares = np.sum(x ** 2) | |
| # if your data is in a list, not a numpy array: | |
| sum_of_squares = np.sum(np.array(x) ** 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment