NUMERICAL INTEGRATION - file.upi.edufile.upi.edu/Direktori/FPMIPA/JUR._PEND._MATEMATIKA/... · This...

29
NUMERICAL INTEGRATION By : Dewi Rachmatin

Transcript of NUMERICAL INTEGRATION - file.upi.edufile.upi.edu/Direktori/FPMIPA/JUR._PEND._MATEMATIKA/... · This...

NUMERICAL INTEGRATION

By :Dewi Rachmatin

The Trapezoidal Rule• Theorem (Trapezoidal Rule)

Consider y=f(x) over [x0,x1], where x1=x0+h. The trapezoidal rule is

This is an numerical approximation to the integral of f(x) over [x0,x1] and we have the expression

• The remainder term for the trapezoidal rule is

where c lies somewhere between x0 and x1 have the equality

Composite Trapezoidal Rule

An intuitive method of finding the area under a curve y = f(x) is by approximating that area with a series of trapezoids that lie above the intervals . When several trapezoids are used, we call it the composite trapezoidal rule.

Theorem (Composite Trapezoidal Rule)

• Consider y=f(x) over [a,b]. Suppose that the interval [a,b] is subdivided into m subintervals of equal width by using the equally spaced nodes xk=x0+kh for k=1,2,…,m. The composite trapezoidal rule for m subintervals is

• That is an numerical approximation to the integral of f(x) over [a,b] and we write

Algorithm Composite Trapezoidal Rule

• To approximate the integral

by sampling f(x) at the m+1 equally spaced points xk=a+kh for k=0,1,…,m , where .Notice that x0 = a and xm = b.

Mathematica Subroutine (Trapezoidal Rule)

• Example 1. Numerically approximate the integral

by using the trapezoidal rule with m = 1, 2, 4, 8, and 16 subintervals.

• Example 2. Numerically approximate the integral in example 1 by using the trapezoidal rule with m = 50, 100, 200, 400 and 800 subintervals.

Simpson's Rule• The numerical integration technique

known as "Simpson's Rule" is credited to the mathematician Thomas Simpson (1710-1761) of Leicestershire, England. His also worked in the areas of numerical interpolation and probability theory.

Theorem(Simpson's Rule)

• Consider y=f(x) over [x0,x2], where x1=x0+h and x2=x0+2h . Simpson's rule is

This is an numerical approximation to the integral of over and we have the expression

• The remainder term for Simpson's rule iswhere lies somewhere between x0 and x2 have the equality

Composite Simpson Rule• Our next method of finding the area

under a curve y=f(x) is by approximating that curve with a series of parabolic segments that lie above the intervalsWhen several parabolas are used, we call it the composite Simpson rule.

Theorem (Composite Simpson's Rule)

• Consider y=f(x) over [a,b]. Suppose that the interval [a,b] is subdivided into 2m subintervals of equal width by using the equally spaced sample points xk=x0+kh for k=0,1,…,m.

• The composite Simpson's rule for subintervals is

This is an numerical approximation to the integral of f(x) over [a,b] and we write

Algorithm Composite Simpson Rule

• To approximate the integral

by sampling f(x) at the 2m+1 equally spaced sample points xk=a+kh for k=0,1,…,2m, where .Notice that x0 = a and x2m = b .

Mathematica Subroutine (Simpson Rule)

• Example 1. Numerically approximate the integral

by using Simpson's rule with m = 1, 2, 4, and 8 subintervals.

• Example 2. Numerically approximate the integral in example 1 by using the Simpson's rule with m = 10, 20, 40, 80, and 160 subintervals.

Gauss-Legendre Quadrature

• We wish to find the area under the curve y=f(x) for -1 ≤ x ≤ 1 . What method gives the best answer if only two function evaluations are to be made? We have already seen that the trapezoidal rule is a method for finding the area under the curve that uses two function evaluations at the endpoints (-1,f[-1]) and (1,f[1]). But if the graph of y = f(x) is concave, the error in approximation is the entire region that lies between the curve and the line segment joining the points.

• If we are permitted to use the nodes x1and x2 that lie inside the interval[-1,1], the line through the two points (x1,f(x1)) and (x2,f(x2)) crosses the curve, and the area under the line more closely approximates the area under the curve. This method is attributed to Johann Carl Friedrich Gauss (1777-1855) and Adrien-Marie Legendre (1752-1833).

Theorem (Gauss-Legendre Quadrature)

• An approximation to the integral

is obtained by sampling at f(x) the n unequally spaced abscissaswhere the corresponding weights are .The abscissa's and weights for Gauss-Legendre quadrature are often expressed in decimal form.

• n=2 Rulewhere

• n=3 Rulewhere

Nilai-nilai wn, xn dan galat pemotongan untuk Kuadratur Gauss-Legendre 6 titik

n Bobot wn Absis xn GalatPemotongan

2 1,000000001,00000000

-0,577350270,57735027

≈ f(4) (c)

3 0,555555560,888888890,55555556

-0,7745966700,77459667

≈ f(6) (c)

4 0,347854850,652145150,652145150,34785485

-0,86113631-0,339981040,339981040,86113631

≈ f(8) (c)

n Bobot wn Absis xn GalatPemotongan

5 0,236926890,478628670,568888890,478628670,23692689

-0,90617985-0,5384693100,538469310,90617985

≈ f(10) (c)

6 0,171324490,360761570,467913930,467913930,360761570,17132449

-0,93246951-0,66120939-0,238619190,238619190,661209390,93246951

≈ f(12) (c)

The shifted Gauss-Legendre rule for [a,b]

• Theorem (The Gauss-Legendre Translation). Suppose that the abscissas and weights are given for the n-point Gauss-Legendre rule over [-1,1]. To apply the rule over the interval [a,b], use the change of variable

Then the relationship

is used to obtain the quadrature formula

• Example 1. Use the Gauss-Legendre quadrature rules for n = 2, 3, 4 and 5 points to compute numerical approximations for .

Example 2. Use the Gauss-Legendre quadrature rules for n = 2, 3, 4 and 5 points to compute numerical approximations for

• Example 1. Use the shifted Gauss-Legendre rules for n = 3 points to compute approximations for the integrals