Regula Falsi Method

Back to Programming

Description

The method of regula falsi or false position is also sometimes referred to as the method of linear interpolation. This method is used for solving an equation of one unknown. This method is quite similar to the bisection method. It is one of the oldest approaches to solving an equation.

PROCEDURE

First, we have to locate the interval –

and the graph of f(x) must cross the x-axis at least once between  and .

Then the equation of the straight line passing through  and  is:

This is the chord of the curve

Let this chord intersects x-axis at the point

This is the second assumption of the root which is y = 0 at

This can be given by:

Now we have to calculate

or

Again in a similar way we get:

If we proceed in this way we get the recurrence formula as

GRAPHICAL REPRESENTATION

Algorithm

INPUT:

A function  3x − cos x − 1

OUTPUT:

An isolated root of the equation.

PROCESS:

``````Step 1: Create a function “float  f (float x)”

Step 1.1:  Return (3x – cos x − 1)
[End of the function “float  f (float x)”]

Step 2: Create the function “void main()”
[‘a’ and ‘b’ are two float type variables and initially a = 0.0 and b = 1.0]

Step 2.1: While(f(a) * f(b) > 0)  then  repeat  Step 2.2  to  Step  2.3
Step 2.2: Set   a ← b
Step 2.3: Set  b ← b + 1
[End of Step 2.1 ‘While’ loop]
Step 2.4: Display the two integer values ‘a’ and ‘b’ in which the root lies i.e.
print “a, b”.
Step 2.5: Take the value of Error in a float type variable ‘err’.
Step 2.6: If (f(a) > 0)  then
Step 2.7: Set  a ← a + b
Step 2.8: Set  b ← a − b
Step 2.9: Set  a ← a − b
[End  of  ‘If’]
Step 2.10: Do Step 2.11 to Step  to Step 2.18
Step2.11: Set  y ← x
Step 2.12: Set  x ← a − ((f(a) / (f(b) − f(a))) × (b − a))
Step 2.13:  If(f(x) < 0)  then
Step 2.14: Set  a ← x
[End of  ‘If’]
Step 2.15: Else
Step 2.16: Set  b ← x
[End of ‘Else’]
Step 2.17: Print “a, b, f(a),f(b), x, f(x)”
Step 2.18: While(fabs(x - y) > err) then go to Step 2.10 repeatedly
Step 2.19: Display the value of the root correct up to 4 decimal places
i.e. print “x”
[End of the function “void main()”]

Step 3: Stop``````

Code

1. The formula is very simple for computation.

2. This method does not require the value of derivatives to be restricted for convergence.

3. The method is evidently convergent.