Created
January 16, 2020 10:43
-
-
Save tarlanahad/8dea3f05836275dd4f131ffe7c6d0e85 to your computer and use it in GitHub Desktop.
This file contains 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
import numpy as np | |
def error(current_pos): | |
x = current_pos[0] | |
y = current_pos[1] | |
return (x ** 2 - 10 * np.cos(2 * np.pi * x)) + \ | |
(y ** 2 - 10 * np.cos(2 * np.pi * y)) + 20 | |
def grad_error(current_pos): | |
x = current_pos[0] | |
y = current_pos[1] | |
return np.array( | |
[2 * x + 10 * 2 * np.pi * x * np.sin(2 * np.pi * x), | |
2 * y + 10 * 2 * np.pi * y * np.sin(2 * np.pi * y)]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment