用迭代法求x=a,求立方根的迭代公式为:4 假定x的初值为a,迭代到Xi+1-Xi<==10-5为止。←
时间: 2024-05-22 08:14:37 浏览: 154
迭代公式为:Xi+1 = (2/3)Xi + (a/(3Xi^2))
其中,a为要求立方根的数,Xi为第i次迭代得到的近似值。
具体迭代过程如下:
1. 取初始值X0 = a;
2. 根据迭代公式,计算得到X1 = (2/3)X0 + (a/(3X0^2));
3. 重复以上步骤,计算得到X2、X3、X4…… 直到满足条件:|Xi+1 - Xi| < 10^-5。
4. 最终得到的Xi就是近似的立方根。
例如,求27的立方根:
取初始值X0 = 27,代入迭代公式得到:
X1 = (2/3)X0 + (27/(3X0^2)) = (2/3)×27 + (27/(3×27^2)) = 19
X2 = (2/3)X1 + (27/(3X1^2)) = (2/3)×19 + (27/(3×19^2)) ≈ 10.964
X3 = (2/3)X2 + (27/(3X2^2)) = (2/3)×10.964 + (27/(3×10.964^2)) ≈ 6.4
X4 = (2/3)X3 + (27/(3X3^2)) = (2/3)×6.4 + (27/(3×6.4^2)) ≈ 4.3
X5 = (2/3)X4 + (27/(3X4^2)) = (2/3)×4.3 + (27/(3×4.3^2)) ≈ 3.3
X6 = (2/3)X5 + (27/(3X5^2)) = (2/3)×3.3 + (27/(3×3.3^2)) ≈ 3.002
X7 = (2/3)X6 + (27/(3X6^2)) = (2/3)×3.002 + (27/(3×3.002^2)) ≈ 3.00002
由于|X7 - X6| < 10^-5,迭代结束,最终得到27的立方根约为3.00002。
阅读全文