You should be able to do this by defining a new function inline:
def fourier_series(f, N):
def F(x):
...
return F
You are not limited to the arguments you pass in to fourier_series
:
def f(a):
def F(b):
return b + 5
return F
>>> fun = f(10)
>>> fun(3)
8