考虑查找多项式和直线交点的示例
$y_1=x_1^2$
$y_2=x_2+1$
from scipy.optimize import fsolve import numpy as np def f(xy): x, y = xy z = np.array([y - x**2, y - x - 1.0]) return z fsolve(f, [1.0, 2.0])
array([ 1.61803399, 2.61803399])
另请参阅: https://docs.scipy.org.cn/doc/scipy/reference/generated/scipy.optimize.fsolve.html#scipy.optimize.fsolve
章节作者: nokfi