http://introcs.cs.princeton.edu/java/13flow/Sqrt.java.html :
public class Sqrt {
public static void main(String[] args) {
// read in the command-line argument
double c = Double.parseDouble(args[0]);
double epsilon = 1e-15; // relative error tolerance
double t = c; // estimate of the square root of c
// repeatedly apply Newton update step until desired precision is achieved
while (Math.abs(t - c/t) > epsilon*t) {
t = (c/t + t) / 2.0;
}
// print out the estimate of the square root of c
System.out.println(t);
}
}
事は..私はプログラム自体がどのように機能するかを完全によく理解しています。私が抱えている問題は、式 f(x) = x^2 - c と、それが上記のコードにどのように関係しているかです。同様に、なぜそれを x で割って x(x - c/x) になるのでしょうか? これらの例のいくつかに関しては、数学的な説明が欠けているようです。言い換えれば、コーディングではなく、単純な数学的な観点からの説明を探しています。