Excersize

From Ivan Kirilenkov, 2 Months ago, written in Python, viewed 60 times.
URL http://codebin.org/view/c1419fb3 Embed
Download Paste or View Raw
  1. import numpy as np
  2.  
  3. def func(x):
  4.     return (x[0] + x[1] - 1)**2 + (x[0] - x[1] - 2)**2
  5.  
  6. def gradient(x):
  7.     return np.array([4 * x[0] - 6, -6])
  8.  
  9. print(gradient(np.array([0, 0])))
  10. print(gradient(np.array([0.5, 0.3])))

Reply to "Excersize"

Here you can reply to the paste above