I'm trying to find x of intersection between two simple math functions using only scipy.optimize.minimize I found the point successfully using (fsolve)
fsolve(lambda t: f1(t) - f2(t), x0)
but I'm limited to using only minimize and I couldn't find any solution, any idea?
CodePudding user response:
from scipy.optimize import minimize
minimize(lambda t: (f1(t) - f2(t))**2, x0)
should work. For a detailed explanation why, see here for instance.