Solution (source code)

= Solution

The <Newton root-finding iteration> follows the current <tangent line> to its horizontal-axis intersection. Since $f'(x)=2x$, it gives
$$
\boxed{x_{n+1}=x_n-\frac{x_n^2-a}{2x_n}
=\frac12\left(x_n+\frac a{x_n}\right),\qquad x_n\ne0.}
$$
A positive initial guess is appropriate for the positive <square root>; negative starting values instead target the negative root.