1
$\begingroup$

The use of linear interpolation is shown (in textbook) together with interval bisection and Newton-Raphson process as an introduction to numerical methods. The basic idea is when a root of the function $f(x)$ lies in a given interval, we draw a straight line between those two points, and with aid of similar triangles, we can use the root of the straight line as our approximation.

The problem I have with this method is exactly at which stage can I obtain an approximation to the required degree of accuracy. As an example, the equation $$x^3+4x-9=0$$ with initial interval $[1,2]$ has subsequent intervals of:

  • $[1.363...,2]$,
  • $[1.443...,2]$,
  • $[1.460...,2]$, and
  • $[1.463...,2]$ respectively.

It is written that "Two successive approximations give the root as $1.5$ to one d.p." so we can stop there. However, I don't think it's obvious that further use of the method would not give a lower bound greater than $1.5$ (or more likely, greater than $1.46$ for $2$ d.p.). As opposed to the method of interval bisection where the lower bound and upper bound gives the same result when rounded to the required accuracy, here the upper bound is still $2$, and anything could happen for such a wide interval if we assume no algebraic understanding of the curve. Any insights?

$\endgroup$
1
  • $\begingroup$ @LutzLehmann you're right. That's a typo, corrected. $\endgroup$ Commented Jan 29, 2021 at 6:14

1 Answer 1

2
$\begingroup$

The polynomial that produces your values is $p(x)=x^3+4x-9$. Then indeed the regula-falsi or false position method, that is, the bracketing method using the secant root,

a,b=1,2
f=lambda x: x*(x*x+4)-9
fa,fb = f(a),f(b)
for k in range(2,20):
    c = b-fb*(b-a)/(fb-fa)
    fc = f(c)
    if fa*fc > 0:
        a,fa = b,fb
    if abs(c-b) < 1e-10: break
    b,fb = c,fc

produces the points and values

step x f(x)
c[0]=a 1 -4
c[1]=b 2 7
c[2] 1.3636363636363638 -1.0097670924117192
c[3] 1.443860801050558 -0.21449107408405865
c[4] 1.46039514739571 -0.04375583788976023
c[5] 1.4637471747797475 -0.008851314007729982
... ... ...
c[15] 1.4645957011474617 -9.946194978738276e-10
c[16] 1.4645957012235364 -2.007709554163739e-10

As all the values found are negative, only the point with negative value gets changed, the other side of the interval with the positive value remains unchanged. This stalling behavior is rather typical of the "plain vanilla" regula falsi method.

There are anti-stalling modifications that shift the calculated mid-point more and more towards the stalling side so that eventually a point gets found that replaces that end of the interval. The easiest is the so-called Illinois variant that reduces the function value at the stalling side by a factor of 2 in each stalling step.

a,b=1,2
f=lambda x: x*(x*x+4)-9
fa,fb = f(a),f(b)
for k in range(2,20):
    c = b-fb*(b-a)/(fb-fa)
    fc = f(c)
    if fa*fc > 0:
        a,fa = b,fb
    else:              # this new branch is the only change
        fa *= 0.5
    if abs(c-b) < 1e-10: break
    b,fb = c,fc

resulting in an iteration

step x f(x)
c[0]=a 1 -4
c[1]=b 2 7
c[2] 1.3636363636363638 -1.0097670924117192
c[3] 1.443860801050558 -0.21449107408405865
c[4] 1.475974727761858 0.11931191740107039
c[5] 1.4644961782313235 -0.0010384912181606865
c[6] 1.4645952254470451 -4.964985366839869e-06
c[7] 1.4645961724498568 4.9171042082463146e-06
c[8] 1.464595701242682 -9.841016890277388e-13
c[9] 1.4645957012427764 0.0

Note that the sign of the values alternates frequently, and apparently the convergence is super-linear, here as fast as the Newton method in terms of function evaluations.

See also Bracketing root-finding methods: my modified Illinois method, https://stackoverflow.com/questions/22273751/regula-falsi-algorithm

Using a multi-precision floating point type, one can continue the table above to ever smaller errors, where the period-3 pattern of the error progression becomes clearly visible

k $c_k$ $c_k-c_{k-1}$ $f(c_k)$
8 1.464595701242682 -4.7120717493e-07 -9.8507967689e-13
9 1.464595701242776 9.4400382608e-14 -1.9544502434e-19
10 1.464595701242776 3.7459071605e-20 1.9544494679e-19
11 1.464595701242776 -1.8729532086e-20 -1.5413207939e-39
12 1.464595701242776 1.4770510950e-40 -1.2155181734e-59
13 1.464595701242776 2.3296674592e-60 1.2155181734e-59
14 1.464595701242776 -1.1648337296e-60 -5.9616556262e-120
15 1.464595701242776 5.7130676528e-121 -2.9239659746e-180
16 1.464595701242776 5.6040860040e-181 2.9239659746e-180
$\endgroup$
1
  • $\begingroup$ This is a nice modification that could narrow down the interval significantly. Thank you! $\endgroup$ Commented Jan 29, 2021 at 6:45

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.