Skip to content

Commit e27e8df

Browse files
twfkshadamant-pwn
authored andcommitted
modified newton's method for finding roots
1 parent d7a84e8 commit e27e8df

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/num_methods/roots_newton.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,24 @@ We want to solve the equation. More precisely, we want to find one of its roots
1818

1919
The input parameters of the algorithm consist of not only the function $f(x)$ but also the initial approximation - some $x_0$, with which the algorithm starts.
2020

21+
![](roots_newton.png)
22+
2123
Suppose we have already calculated $x_i$, calculate $x_{i+1}$ as follows. Draw the tangent to the graph of the function $f(x)$ at the point $x = x_i$, and find the point of intersection of this tangent with the $x$-axis. $x_{i+1}$ is set equal to the $x$-coordinate of the point found, and we repeat the whole process from the beginning.
2224

23-
It is not difficult to obtain the following formula:
25+
It is not difficult to obtain the following formula,
2426

2527
$$ x_{i+1} = x_i - \frac{f(x_i)}{f^\prime(x_i)} $$
2628

29+
First, we calculate the slope $f'(x)$, derivative of $f(x)$, and then determine the equation of the tangent which is,
30+
31+
$$ y - f(x_i) = f'(x_i)(x - x_i) $$
32+
33+
The tangent intersects with the x-axis at cordinate, $y = 0$ and $x = x_{i+1}$,
34+
35+
$$ - f(x_i) = f'(x_i)(x_{i+1} - x_i) $$
36+
37+
Now, solving the equation we get the value of $x_{i+1}$.
38+
2739
It is intuitively clear that if the function $f(x)$ is "good" (smooth), and $x_i$ is close enough to the root, then $x_{i+1}$ will be even closer to the desired root.
2840

2941
The rate of convergence is quadratic, which, conditionally speaking, means that the number of exact digits in the approximate value $x_i$ doubles with each iteration.

src/num_methods/roots_newton.png

6.38 KB
Loading

0 commit comments

Comments
 (0)