I am trying to do a fit to a given function using Scipy. Scipy.optimize.leastsq needs a vectorized function as one of the input parameters.
This all works fine, but now I have a more complicated function which is not vectorized automatically by Scipy/Numpy.
def f1(a, parameters):
b, c = parameters
result = scipy.integrate.quad(integrand, lower, upper, (a, b, c))
return result
or to give a closed example numpy.vectorize also does not work with
def f2(a, parameters):
b, c = parameters
return a+b+c
Is there a possibility to vectorize these functions in Scipy/Numpy?
Thank you for any help!
Alexander
Sorry, I’m not sure what the question is. Python
*argscollects any number of args,which a function can unpack as it pleases; see
docs.python.org/tutorial/…