![]() | Suppose we need a function of x and y with three additional parameters a, b, and c:
def f(x, y, a, b, c): return a + b*x + c*y*y |
![]() | Suppose we need to send this function to another function
def gridvalues(func, xcoor, ycoor, file): for i in range(len(xcoor)): for j in range(len(ycoor)): f = func(xcoor[i], ycoor[j]) file.write('%g %g %g\n' % (xcoor[i], ycoor[j], f)func is expected to be a function of x and y only (many libraries need to make such assumptions!) |
![]() | How can we send our f function to gridvalues? |