I want to make numpy.piecewise function based on lambdas defined with parameters in lists. To illustrate the problem in the title, here's a simpler example:
import numpy as np
import matplotlib.pyplot as plt
xx = np.linspace(0,5,101)
powers = [1,2]
funcs = []
for i in range(2):
power = powers[i]
funcs.append(lambda x: x**power)
f1, f2 = funcs
plt.plot(xx,f1(xx))
f1 should be the linear function and f2 should be the quadratic function, but they're both quadratic. I'm not sure why.