I am programming in python and I want to plot a function defined by as "objFun (inputPoint, parameter2, parameter3)" with three arguments where the first argument is the point (a numpy array of 2 elements or coordinates) at which the function value is computed. My approach is
x = np.linspace(-10,10,50)
y = np.linspace(-10,10,50)
X,Y = np.meshgrid(x,y)
However I don't know how to pass X and Y as arguments to objFun since it accepts a single dimensional array of variables. I can't change the function to accept both X and Y as arguments. An example of objFun is a follows:
def objFun (x, alpha, beta):
if alpha > 0 :
return x[0]^2+x[1]^2
else if beta > 0 :
return x[0] + x[1]
else:
return 0
I want to feed mesh points X, Y to x[0] and x[1].