Chapter1 Num Methods For Alg Eqns
Chapter1 Num Methods For Alg Eqns
Chengjie Cai
School of Mathematical Sciences
2022-23
Lecture 2 An introduction to numerical methods
Today, we will:
appreciate why and how numerical methods work for solving both
algebraic and dierential equations;
learn about the bisection method and the Newton-Raphson method
for solving algebraic equations; how they work, and pros and cons.
Provided f (x) is continuous over our initial interval [a; b], the method
will always work (a desirable feature that not all numerical methods
have).
However, as we saw, the method is very tedious to do by hand, even
with a calculator. This is because the method was hard to automate
with our calculator.
Furthermore, the method converges very slowly; it took 8 iterations
just to get 2 decimal places of accuracy!
Due to these disadvantages, the bisection method is not typically used.
But how do we
automate this process?
We can write down an
iterative formula for
this process.
Type the RHS of the above formula, but replace xn with `Ans'.
Then just keep pressing `=' (writing down our answers as we go).
Therefore:
Choose x0 = 2.
x0 x1 x2 x3 x4 x5 x6
2
The N-R method typically converges a lot faster than the bisection
method.
However, unlike the bisection method, the Newton-Raphson method
does not always converge correctly.
For example, consider the above example, but starting with x0 = 1:
x0 x1 x2 x3 x4
1 0.66667... 0.74811... 0.74713... 0.74713...
Example:
1
With x0 = 5, approximate the solution to f (x) = − 2 = 0.
x −3
Note: the actual solution nearby is x = 3:5.
f 0 (x) =
x0 x1 x2 x3
5
Uh oh! Let's see what went wrong.
Chengjie Cai (UoN) MATH2052 2022-23 15 / 19
The Newton-Raphson method shortcomings
We will learn how to write programs in Python for both the bisection
method and the N-R method in a future workshop.
Chengjie Cai (UoN) MATH2052 2022-23 17 / 19
Lecture 2 summary
Numerical methods allow us to approximate the solutions to equations
that are too dicult/impossible to solve exactly.
In the bisection method, we bisect the interval which contains the
solution, and choose the half that still contains the solution.
The Newton-Raphson method works by considering intersections
between tangents to the function and the x -axis. The formula is
f (xn )
xn+1 = xn − :
f 0 (xn )
Both of these methods are iterative; they provide a rule that we
repeat, with our approximation (hopefully) becoming more accurate
with each repeat.
The bisection method works every time (if the function is continuous
over the original interval), but is slow.
The Newton-Raphson method converges much faster, but is prone to
failure at points with shallow gradients.
Chengjie Cai (UoN) MATH2052 2022-23 18 / 19
Lecture 2 optional feedback question
(a) Show that the equation 3 sin x = x has a root x ∈ [2; 3] (in radians).
(b) Using the Newton-Raphson method, approximate this root to 4 d.p..
Note how many iterations it takes.
(c) Using this GeoGebra le (or otherwise), approximate the same root to
4 d.p. using the bisection method, starting with the interval [2; 3].
Note how many iterations it takes.
(d) Comment on the success of the two methods.