跳到主要内容

资源 · 指南或文章

Square Root (Newton's Method)

推导牛顿-拉弗森迭代法,并将其用于计算平方根,这正是“不用库函数实现 sqrt”这类题背后的方法。需要一定的微积分(导数)基础。

审核日期

打开原站: Square Root (Newton's Method) (在新标签页中打开原网站)

添加到路线图

把这个资源放进你正在跟进的路线图。它会作为你自己的补充资源显示;路线图的步骤不会改变,也不计入你已记录的步骤。

来源内容语言:英语

In numerical analysis, a branch of mathematics, there are several square root algorithms or methods of computing the principal square root of a non-negative real number. As, generally, the roots of a function cannot be computed exactly. The root-finding algorithms provide approximations to roots expressed as floating point numbers. Finding is the same as solving the equation for a positive x. Therefore, any general numerical root-finding algorithm can be used. Newton's method (also known as the Newton–Raphson method), named after Isaac Newton and Joseph Raphson, is one example of a root-finding algorithm. It is a method for finding successively better approximations to the roots of a real-valued function.

PrepKit 概览

本概览由 PrepKit 编辑根据源代码仓库撰写并审核,并非资源本身的文字。

适合人群
来源未说明适用级别
形式
课程

涵盖内容

  • Newton's Method General Idea:利用函数及其导数改进猜测值,以及切线示意图。
  • Newton's Method of Finding a Square Root:更新公式 x := x - (x 的平方 - S) / (2x)。
  • 为什么修正量要除以导数 2x。

使用建议

这是 PrepKit 的学习建议,并非来源的说法。

编写带容差检查的更新过程,对几个输入与 Math.sqrt 的结果进行比较,并解释你如何选择初始猜测值和停止条件。

范围与局限

公式大多是 Wikimedia 图片。没有收敛性分析、仅限整数的变体或二分查找替代方案。

获取方式与形式

GitHub 上的英文 README(采用 MIT 许可的 trekhleb/javascript-algorithms);免费阅读。

PrepKit 于 2026年10月2日 审核。 资源来源提交: 85293e3e2b88

本概览的依据
  • src/algorithms/math/square-root/README.md

收录此条目的页面

订阅 PrepKit 通讯

可选。使用 PrepKit 并不需要订阅。

我们如何处理你的邮箱