本文へスキップ

リソース · ガイド・記事

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 squared - S) / (2x)。
  • 補正量を導関数 2x で割る理由。

使い方

PrepKit の学習アドバイスであり、ソースの主張ではありません。

許容誤差のチェック付きで更新式をコードにし、いくつかの入力で Math.sqrt と結果を比べてください。初期値と停止条件をどう選んだかを説明します。

範囲と制約

公式の大半は Wikimedia の画像です。収束の分析、整数だけで計算する変形、二分探索による代替案はありません。

利用方法と形式

GitHub にある英語の README で(MIT ライセンスの trekhleb/javascript-algorithms)、無料で読めます。

PrepKit が 2026/10/02 に確認しました。 リソースの出典のコミット: 85293e3e2b88

この概要の根拠
  • src/algorithms/math/square-root/README.md

この項目を掲載しているページ

PrepKit ニュースレターを受け取る

任意です。PrepKit の利用には必要ありません。

メールアドレスの取り扱いについて