# -*- 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 = ((4 - 2.1*x**2 + x**4 / 3.) * x**2 + x * y
     #       + (-4 + 4*y**2) * y **2)
    
    f = (x-1)**2 + (y)**2
    
    return f

def F(x):
    F = f(x[0],x[1])
    return F

def xline(t,x0,p0):
    # given a starting position x0 and a direction
    # p0, computes the position x = x0+t*p0
    #
    # Here t=float
    # x0 = ND array of floats
    # p0 = ND array of floats
    
    xline = x0 + p0*t
    
    return xline


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))

plt.show()





