Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

All published worksheets from http://sagenb.org

Views: 168731
Image: ubuntu2004

Suppose we want to find a numerical approximation to 2\sqrt{2}.  Here's one way to approach it with Newton's method.

f(x) = x^2 - 2 N(x) = expand(x - f(x)/diff(f(x),x)) show(N(x))
\newcommand{\Bold}[1]{\mathbf{#1}}\frac{1}{2} \, x + \frac{1}{x}

Now, we iterate.

xi = 1.0 for i in range(5): xi = N(xi) print(xi)
1.50000000000000 1.41666666666667 1.41421568627451 1.41421356237469 1.41421356237309