i want to write a function that accepts two lists, one of x values and one of y(x) values and returns the corresponding y(x) value when given an x value. i also want to use linear interpolation to find y(x) for values of x between the numbers in the list. for example
f = function([3, 4, 6], [0, 1, 2])
print f(3)
should return 0.0
so far i don't have a full code but i am attempting to use
interp1d(numpy.array(xs), numpy.array(ys), 'linear')
for the interpolation
for i in range(len(xs)):
return ys[i]
and this for the values in the list, but i dont really know how to put it together