I have a function eqn which I want minimized by changing the values of two variables (floats), a and b. However, eqn uses a for loop to obtain values for constants, which are unrelated to a and b, from the lists list1 and list2, as shown:
def eqn(a, b, list1, list2):
value = 0
for i in range(len(list1):
value = value + ((a - (1 - exp(- c * list1[i]) - list2[i]) ** 2)
return value
I am unsure how to include the iterative inclustion of list members as constants in scipy.optimize.minimize, and I can't find any mention of it in the documentation
I have already got a nested for-loop to manually minimize the function by brute force w.r.t. a and b, but I cannot get to the precision level that I need before running into a mem error.
Any help would be greatly appreciated.