Computational Methods in Physics: Seminar
Computational Methods in Physics: Seminar
Computational Methods in Physics: Seminar
ABSTRACT
COMPUTATIONAL METHODS IN PHYSICS
18MSPH2H04
Krishna Agarwal
MULLER’S METHOD
In this method f(x) is approximated by a second degree curve in the vicinity of root. The roots of
quadratic equation are then assumed to be approximation of roots f(x) = 0. This method is iterative
This is an iteration method just like secant method unlike secant there are 3 distinct approximations.
The rate of convergence, i.e., how much closer we move to the root at each step, is approximately 1.84
in Muller Method, whereas it is 1.62 for secant method, and linear, i.e., 1
for both Regula – falsi Method and bisection method . So, Muller Method
is faster than Bisection, Regula – Falsi and Secant method. Although, it is
slower than Newton – Raphson’s Method, which has a rate of
convergence of 2, but it overcomes one of the biggest drawbacks of
Newton-Raphson Method, i.e., computation of derivative at each step.
f ( x )=0
Let y i−2 , y i−1 , yi be corresponding values of y=f (x ). Now any second degree curve passing trough
point ( x i , y i ) can be written as
Since the curve also pass through ( x i−1 , y i−1) and( x i−2 , y i−2) , we get
y i−1− y i y i−2− y i
A= +
(x i−1 −xi−2 )(x i−1 −xi ) (x i−2−x i )( xi−2−x i−1 )
And,
y i−1− y i
B= − A(x i−1−x i)
x i−1−x i
Substituting these two values in equation (1) we’ll get our 1 st approximation x i+1
2 yi
x i+1=x i−
B± √ ( B ¿ ¿ 2 ¿−4 A y i) ¿ ¿
The sign in denominator should be chosen so the denominator will be largest in magnitude. With this
choice the next approximation root will have low error.
C-Program
#include<stdio.h>
#include<math.h>
#define I 2
float f(float x)
{
return x*x*x-2*x-5;
}
main ()
{
int i, itr, maxmitr;
float x[4], li, di, mu, s, l, allerr;
printf("\nEnter the three initial guesses:\n");
for (i=I-2; i<3; i++)
scanf("%f", &x[i]);
printf("Enter allowed error and maximum iterations:\n");
scanf("%f %d", &allerr, &maxmitr);
for (itr=1; itr<=maxmitr; itr++)
{
li = (x[I] - x[I-1]) / (x[I-1] - x[I-2]);
di = (x[I] - x[I-2]) / (x[I-1] - x[I-2]);
mu = f(x[I-2])*li*li - f(x[I-1])*di*di + f(x[I])*(di+li);
s = sqrt ((mu*mu - 4*f(x[I])*di*li*(f(x[I-2])*li - f(x[I-1])*di + f(x[I]))));
if (mu < 0)
l = (2*f(x[I])*di)/(-mu+s);
else
l = (2*f(x[I])*di)/(-mu-s);
x[I+1] = x[I] + l*(x[I] - x[I-1]);
printf("At iteration no. %3d, x = %7.5f\n", itr, x[I+1]);
if (fabs (x[I+1] - x[I]) < allerr)
{
printf("After %3d iterations, the required root is %6.4f\n", itr, x[I+1]);
return 0;
}
for (i=I-2; i<3; i++)
x[i] = x[i+1];
}
printf("The required solution does not converge or iterations are insufficient\n");
return 1;
}
References