# -*- coding: utf-8 -*-
"""
Created on Tue Aug 16 15:05:18 2022

@author: 102194
"""
import numpy as np
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D

def f(x,y):
    
    f = (x-1)**2 + (y)**2
    
    return f


x = np.linspace(-2,2,100)
y = np.linspace(-1,1,100)

X,Y = np.meshgrid(x,y)
#plt.pcolor(X,Y,f(X,Y))
#plt.contour(X,Y,f(X,Y),100)

fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
surf = ax.plot_surface(X, Y, f(X,Y))

x0 = np.array([-2,-1])
p0 = np.array([1,1])

h = 0.1
for i in range(0,20):
    t = h*i
    
    x = x0 + t*p0
    
    ax.plot(x[0],x[1],f(x[0],x[1]),'ro')
    
plt.show()






