Doing many iterations of curve_fit in one go for piecewise function
问题 I'm trying to perform what are many iterations of Scipy's curve_fit at once in order to avoid loops and therefore increase speed. This is very similar to this problem, which was solved. However, the fact that the functions are piece-wise (discontinuous) makes so that that solution isn't applicable here. Consider this example: import numpy as np from numpy import random as rng from scipy.optimize import curve_fit rng.seed(0) N=20 X=np.logspace(-1,1,N) Y = np.zeros((4, N)) for i in range(0,4):