Numerical Lecture 3

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

Numerical Methods and

Probability
Prepared by
Dlnya sabir salih
Example 1 :False-position method applied to f(x) = x2 - 3.

𝑿𝒍 𝑿𝒖 f(𝑿𝒍 ) f(𝑿𝒖 ) 𝑿𝒓 f(𝑿𝒓 ) Update

1.0 2.0 -2.00 1.00 1.6667 -0.2221 𝑋𝑙 = 𝑋𝑟

1.6667 2.0 -0.2221 1.0 1.7273 -0.0164 𝑋𝑙 = 𝑋𝑟

1.7273 2.0 -0.0164 1.0 1.7317 0.0012 𝑋𝑙 = 𝑋𝑟

with the third iteration, we note that the last step the difference between the
two points 1.7273 → 1.7317 is less than 0.01
Exercise : find the root of f(x) = 𝑥 3 − 2𝑥 − 5 on
the interval [3, 4], with ε = 0.001. using
bisection and false position method
Newton-Raphson method

The algorithm of the Newton-Raphson method is very simple as


follows:
Exercise
Secant method

The algorithm of the secant method can be written as follows:


The secant method applied to f(x) = cos(x) + 2 sin(x) + x2,
use x0 = 0 and x1 = -0.1 as initial approximations, let e= 0.001.

n xn − 1 xn xn + 1 |xn + 1 - xn|

1 0.0 -0.1 -0.5136 0.4136

2 -0.1 -0.5136 -0.6100 0.0964

3 -0.5136 -0.6100 -0.6514 0.0414

4 -0.6100 -0.6514 -0.6582 0.0068

5 -0.6514 -0.6582 -0.6598 0.0016

6 -0.6582 -0.6598 -0.6595 0.0003

after six iterations, our approximation to the root is -0.6595 .

You might also like