Gradient descent

Define a function returning $z = f(x, y)$ and a function returning its gradient $\left(\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}\right)$.

In particular, use $z = f(x, y) = -\left(\cos^2 x + \cos^2 y \right)^2$.

Make 2D matrices grid_x, grid_y, and grid_z for 3D plot of $\left\{(x, y, z)\right\}$, where $z=f(x, y)$

Show gradient descent:

Convert the code above into a function

Test gradient_descent() on a familiar 1D function

Test gradient_descent() on the 2D function from the lecture notes