def f(x): return x + math.exp(x) - 2 def df(x): return 1 + math.exp(x) import math # 初始近似值 x0 = 1.0 # 最大迭代次数 max_iter = 100 # 精度 tolerance = 1e-6 for i in range(max_iter): fx0 = f(x0) dfx0 = df(x0) x1 = x0 - fx0 / dfx0 if abs(x1 - x0) < tolerance: break x0 = x1 print("解 x 的近似值为:", x0)
@gary0617 Жыл бұрын
謝謝
@choupeter-jd2le8 ай бұрын
前面幹嘛打叉,不是接下去嗎
@ikramkika5196 Жыл бұрын
Professor, I am from Algeria and I have understood some of your mathematics concepts. Do you have an Instagram page with exercises to help us more? Thank you.