热门标签
更多>
搜索结果
查询Tags标签: phip,共有 2条记录-
0.618法(最优化方法)Python实现
def f(x):return x ** 3 - 2 * x + 1def solve(a, b, epsilon):p = a + 0.382 * (b - a)q = a + 0.618 * (b - a)phip = f(p)phiq = f(q)while True:if phip <= phiq:if abs(b - p) <= epsilon:return a, qbreakelse:b = qphiq = phipq = pp = a + 0.382 * (b - a)p…
2021/9/26 20:40:48 人评论 次浏览 -
0.618法(最优化方法)Python实现
def f(x):return x ** 3 - 2 * x + 1def solve(a, b, epsilon):p = a + 0.382 * (b - a)q = a + 0.618 * (b - a)phip = f(p)phiq = f(q)while True:if phip <= phiq:if abs(b - p) <= epsilon:return a, qbreakelse:b = qphiq = phipq = pp = a + 0.382 * (b - a)p…
2021/9/26 20:40:48 人评论 次浏览