0% found this document useful (0 votes)
103 views10 pages

Question Bank-Module-5

Uploaded by

Sayan Mondal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
103 views10 pages

Question Bank-Module-5

Uploaded by

Sayan Mondal
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Numerical Methods

Lecturer: Dr. Sunanda Saha,


Dr. Praneeta Verma,
Dr. Anuradha B. January, 2020

1 Muller’s Method
Muller’s method is a root-finding algorithm, a numerical method for solving equations of the
form f (x) = 0. It was first presented by David E. Muller in 1956.
Muller’s method is based on the secant method, which constructs at every iteration a line
through two points on the graph of f . Instead, Muller’s method uses three points, constructs
the parabola through these three points, and takes the intersection of the x-axis with the
parabola to be the next approximation.
Most of the root-finding methods that we have considered so far have approximated the
function in the neighborhood of the root by a straight line. Muller’s method is based on
approximating the function in the neighborhood of the root by a quadratic polynomial. A
second-degree polynomial is made to fit three points near a root, at x0 ; x1 ; x2 with x0 between
x1 , and x2 . The proper zero of this quadratic, using the quadratic formula, is used as the
improved estimate of the root.
Formula

h0 = x1 − x0 h1 = x2 − x1
f (x1 ) − f (x0 ) f (x2 ) − f (x1 )
δ0 = δ1 =
h0 h1
δ1 − δ0
a= b = ah1 + δ1 c = f (x2 )
h1 + h0
2c
x3 = x2 − √
b + sgn(b) b2 − 4ac
x(new) − x(old)
Percent Relative Error : × 100%
x(new)

1
1.1 Exercise
1. Find the interval in which the smallest negative root of the equation lies and
hence find the approximate root by performing two iterations. Find also the
percent relative error. f (x) = x4 − 3x2 + x − 10

2. Perform two iteration of the Muller Method to find the root of the following
equation
(a) cos x − xex = 0 with initial guess x0 = 0, x1 = 0.5, x2 = 1
(b) x4 + 2x2 − x − 1 = 0 with initial guess x0 = −1/2, x1 = 0, x2 = 1/2
(c) x3 − 2x2 − 5 = 0 with initial guess x0 = −1, x1 = 0, x2 = 1
(d) x − e−x = 0 with initial guess x0 = 0, x1 = 0.5, x2 = 1
(e) x3 − 21 = 0 with initial guess x0 = 0, x1 = 1, x2 = 12
(f) ln(x) − x + 3 = 0 with initial guess x0 = 41 , x1 = 12 , x2 = 1
(g) x3 − 13x − 12 = 0 with initial guess x0 = 4.5, x1 = 5.5, x2 = 5

3. Find the interval in which the smallest positive root of the equation lies and
hence find the approximate root by performing two iterations. Find also the
percent relative error
(a) x3 − x − 4 = 0 (b) x4 − 3x2 + x − 10 = 0
(c) x3 − 5x + 1 = 0 (d) x4 − x − 10 = 0

2 Numerical Integration
2.1 Newton Cote’s Formula
In numerical analysis, the Newton Cotes formula, also called the Newton Cotes quadrature
rules or simply Newton Cotes rules, are a group of formula for numerical integration (also
called quadrature) based on evaluating the integrand at equally spaced points. They are
named after Isaac Newton and Roger Cotes.

2.1.1 Trapezoidal rule:-


In mathematics, and more specifically in numerical analysis, the trapezoidal rule (also known
as the trapezoid rule or trapezium rule) is a technique for approximating the definite integral
Z b
f (x) dx. The trapezoidal rule works by approximating the region under the graph of the
a
function f (x) as a trapezoid and calculating its area. It follows that

2
Formula

Single Application Formula (n = 1) using two base points :


Z b
f (x) dx ≈ h2 [f (a) + f (b)] where h = b−a
1
a
For a domain discretized into n equally spaced panels, or n + 1 base (or grid) points a =
x1 < x2 < . . . · · · < x(n+1) = b; where the grid spacing is h = b−a
n
the approximation to the
integral becomes:-
Multi Application Formula :
Z b
I= f (x) dx ≈ h2 [f (x1 ) + 2{f (x2 ) + · · · + f (xn−1 )} + f (xn )] , where h = b−a
n
a

2.1.2 Simpson’s Rule Formula


Simpson’s Rule Formula is used to calculate the integral value of any function. It calculates
the value of the area under any curve over a given interval by dividing the area into equal
parts. It follows the method similar to integration by parts.
In order to integrate any function f (x) in the interval (a, b), follow the steps given below:

1. Select a value for n, which is the number of parts the interval is divided into. Let the
value of n be an even or multiple of 3 number.
b−a
2. Calculate the width, h = n

3. Calculate the values of x0 to xn as x0 = a; x1 = x0 + h; x2 = x1 + h and so on... ,


xn = b

4. Now find the values of f (x) for the corresponding x(x0 to xn ) values

3
Substitute all the above found values in the Simpson’s Rule to calculate the integral value.
Formula

Single Application Formula (n = 2) for Simpson’s 1/3rd Rule :-(only three base
points)
Z b
I= f (x) dx ≈ h3 [f (x0 ) + 4f (x1 ) + f (x2 )] , where h = b−a
2
a
Multi Application Formula for Simpson’s 1/3rd Rule :-(n + 1 base points)
Z b
I= f (x) dx ≈ h3 [f (x0 )+4{f (x1 )+f (x3 )+f (x5 ) . . . }+2{f (x2 )+f (x4 )+f (x6 ) . . . }+f (xn )],
a
where h = b−a
n
Single Application Formula (n = 3) for Simpson’s 3/8th Rule :-(only four base points)
Z b
3h b−a
I= f (x) dx ≈ 8
[f (x0 ) + 3{f (x1 ) + f (x3 )} + f (x4 ], where h = 3
a

Note:-

• Simpson’s 1/3rd Rule will give appropriate result for even segments i.e n = even
no.

• Simpson’s 3/8th Rule will give appropriate result if no. of segments are multiple
of 3 i.e n = 3, 6, 9, and so on..

• Each term will appear only single time in all the above formulas.

Exercise
1. Evaluate the following integral:
Z π/2 Z 3
(a) (6 + 3 cos x)dx (b) (1 − e−2x )dx
Z 04 0 Z 2
(c) (1 − x − 4x3 + 2x5 )dx (d) (x + 2/x)2 dx
Z−2
5 Z 3 1
3 2 x
(e) (4x − 3) dx (f) x e dx
Z−3 Z π/20
1 1 Z π/2
(g) dx (h) x
e sin2xdx (i) e−x cos2xdx
0 1+x 0 0
(a) analytically; (b) single application of the trapezoidal rule; (c) multiple-
application trapezoidal rule, with n = 2 and 4; (d) single application of Simp-
son’s 1/3 rule; (e) multiple-application of Simpson’s 1/3 rule, with n=4; (f)
single application of Simpson’s 3/8 rule; and (g) multiple-application Simpson’s
rule, with n = 5. For each of the numerical estimates (b) through (g), determine

4
the percent relative error based on (a).

2. Evaluate the integral of the following tabular data with (a) the trapezoidal rule
and (b) Simpson’s rules:
x 0 0.1 0.2 0.3 0.4 0.5
(a)
f(x) 1 8 4 3.5 5 1
x -2 0 2 4 6 8 10
(b)
f(x) 35 5 -10 2 5 3 20
x 1.4 1.6 1.8 2.0 2.2 2.4
(c)
f(x) 4.0552 4.9530 6.0436 7.3891 9.0250 10.7531

2.2 Romberg Integration


Romberg integration is one technique that is designed to attain efficient numerical integrals
of functions. It is based on successive application of the trapezoidal rule. Superior results
are attained for less effort using this method.
Let Tk is the approximate value of the integration using composite Trapezoidal
rule with 2k segments.

Exercise
Z 1/2
x
1. Evaluate dx using Romberg integration correct to 4 decimal places.
0 sin x
2. UseZRomberg integration of order h8 to evaluate the following integration
3 Z 2
1 2
(a) xe2x dx (b) x+ dx
0 1 x

5
Z 2 x
e sin x Z 1
sin x 
(c) 2
dx (d) 1+ dx
Z0 1 1 + x 0 x
1 Z 1.5
2
Z π/2
3x
Z π/4
(e) dx (f) x lnxdx (g) e sin xdx (h) (cos x)2 dx
0 1 + x2 Z 11 Z π/4 0 0
Z 3.5 x
(i) √ dx (j) x2 e−x dx (k) x2 sin xdx
3 x −4
2 0 0

2.3 Gauss-Legendre integration method


A characteristics of Newton-Cotes formulas is that the numerical estimate is based on evenly
spaced function values. Consequently, the location of the base points used in these equations
was predetermined or fixed.
Now, suppose that the constraint of fixed base points was removed and we were free to
evaluate the area under a straight line joining any two points on the curve. By positioning
these points wisely, we could define a straight line that would balance the positive and
negative errors. Hence, we would arrive at an improved estimate of the integral.
Gauss quadrature is the name for one class of techniques to implement such a strategy. The
particular Gauss quadrature formulas described in this section are called Gauss-Legendre
formulas.
Remark 1. 1. This method can be applied only for the integration in the interval
[−1, 1]
b−a b+a
2. Any finite interval [a, b] can be transformed to [−1, 1] by x = t+ .
2 2

Formulas
Z 1
One-point formula: f (x)dx = 2f (0)
−1 ! !
Z 1
1 1
Two-point formula: f (x)dx = f − √ + f √
−1 3s 3 s !
!
Z 1
5 3 8 5 3
Three-point formula: f (x)dx = f − + f (0) + f
−1 9 5 9 9 5

2x Z 2
EXAMPLE: 1. Evaluate dx, using the Gauss-Legendre 1-point, 2-point
1 1 + x4
and 3-point quadrature rules. Compare with the exact solution.

6
SOLUTION 1. The exact solution is I = 0.5404
To use the Gauss-Legendre rules, the interval [1, 2] is to be reduced to [−1, 1] using the trans-
formation x = (t + 3)/2 and
Z 1
8(t + 3) Z 1
I= dx = f (t)dt.
−1 [16 + (t + 3)4 ] −1
Using the 1-point rule, we get I = 0.4948.
Using the 2-point rule, we get I = 0.3842 + 0.1592 = 0.5434.
Using the 3-point rule, we get I = 0.5406.

Exercise
1. Evaluate the following integral bu using the Gauss-Legendre 1-point, 2-point and
3-point quadrature rules.
Z 2
1 Z 2
1
(a) dx (b) 2
dx
Z 03 3 + 4x 0Z x + 2x + 10
cos 2x 1 2
(c) dx (d) e−x cos xdx
Z23 1 + sin x Z .5 −1
1 x
(e) 2
dx (f) dx
Z−3 1 + x
1 Z 0 sin x
3
(g) ex cosxdx (h) x6 − x2 sin(2x)dx
−1 1

3 Numerical Differentiation
3.1 High-Accuracy Differentiation Formulas
High-accuracy divided-difference formulas can be generated by including additional terms
from the Taylor series expansion. For example, the forward Taylor series expansion can be
written as
h2
f (x + h) = f (x) + hf 0 (x) + f 00 (x) + ...
2
which can be solved for
f (x + h) − f (x)
f 0 (x) = + O(h)
h

7
Formulas

First Derivative:
Forward Difference Scheme(FDS):

f (x + h) − f (x)
f 0 (x) = + O(h)
h
Backward Difference Scheme(FDS):

f (x) − f (x − h)
f 0 (x) = + O(h)
h
Central Difference Scheme(FDS):

f (x + h) − f (x − h)
f 0 (x) = + O(h2 )
2h
Second Derivative:
Forward Difference Scheme(FDS):

f (x + 2h) − 2f (x + h) + f (x)
f 00 (x) = + O(h)
h2
Backward Difference Scheme(FDS):

f (x) − 2f (x − h) + f (x − 2h)
f 00 (x) = + O(h)
h2
Central Difference Scheme(FDS):

f (x + h) − 2f (x) + f (x − h)
f 00 (x) = 2
+ O(h2 )
h

Exercise
1. Let f (x) = ln(x) and a = 3. Using both forward, backward and central difference
approximations f 0 (a) using h = 0.1, 0.01.

2. Let f (x) = sin(0.5 x)/x and x = 1. Using both forward, backward and central
difference approximation find f 00 (x) using h = 0.2.

3. Compute the first and second derivatives of f (x) = x2 cos x using suitable ap-
proximations of O(h2 ) using h = 0.1 at x = 0.4.

8
4. The distance x of a runner from a fixed point is measured (in meters) at intervals
of half a second. The data obtained is
t 0 0.5 1.0 1.5 2.0
x 0 3.65 6.80 9.90 12.15.
Use central difference scheme to approximate the runner’s velocity and acclera-
tion at time 0.5s, 1.5s and velocity at 1.25s.

5. Use the following data to find the velocity and acceleration at t = 10 seconds:
t 0 2 4 6 8 10 12 14 16
x 0 0.7 1.8 3.4 5.1 6.3 7.3 8.0 8.4
Use centered finite-difference, forward finite-difference and backward finite-
difference methods.

6. The following data were collected for the distance traveled versus time for a
rocket:
t 0 25 50 75 100 125
Use numerical differentiation to estimate the
x 0 32 58 78 92 100
rocket’s velocity at 0s, 50s and 125s.
dy d2 y
7. From the following table of values of x and y, obtain and for x = 1.2
dx dx2
and x = 2.2.
x 1.0 1.2 1.4 1.6 1.8 2.0 2.2
y 2.7183 3.3201 4.0552 4.9530 6.0496 7.3891 9.0250

3.2 Richardson Extrapolation


This method is based on improving the estimates by using two estimated derivatives. The
algorithm is exactly same as Romberg’s algorithm.

1. The following table of values is given:


x -1 1 2 3 4 5 7
Using the central difference scheme
f(x) 1 1 16 81 256 625 2401
and Richardson extrapolation find f 0 (3).

2. For the following table use central difference formula and perform Richardson
Extrapolation to find:
(a) f 00 (0.6)
x 0.2 0.4 0.5 0.6 0.7 0.8 1.0
f(x) 1.420072 1.881243 2.128147 2.38676 2.65797 2.94289 3.55975
(b) f 0 (1)

9
x 0.6 0.8 0.9 1.0 1.1 1.2 1.4
f(x) .707178 .859892 .925863 .984007 1.033743 1.074575 1.127986

3. Estimate the value of f 00 (π/4) for f (x) = sin x, using h = π/3, π/6 and Richard-
son Extrapolation. Compare with exact value.

4. Given f (x) = 5xe−2x , find the value of f 0 (0.35) using Richardson extrapolation
with central difference scheme with h = 0.5, 0.25 and h = 0.125

5. Estimate the value of f 0 (1.0) for f (x) = e−x sin x, using Richardson extrapolation
with central difference scheme with h = 0.5, 0.125. Compare with exact value.

10

You might also like