Anda di halaman 1dari 3

Numerical Integration and the Trapezoidal rule Lecture Notes. GC university Faisalabad. By: S.

M Alay-e-Abbas

Numerical Integration:
In calculus we come across very complicated and difficult integrals. They are difficult to solve using analytical methods for finding their solutions. This problem can be solved by using numerical integrations e.g. Rectangular rule, limit of Sum definition, Trapezoidal Rule and Simpsons Rule.

Example:
A car accelerates from rest to 50Km/h in 30 seconds find the distance covered by the car using the given data t v 0 0 5 6 10 18 15 27 20 34 25 39 30 50

We know that 30 S =
0

v(t) dt

but we have no knowledge of v as a function of t so it is impossible or even ridiculous to think that given data can be used to solve the value of S by analytical method of integration.

Trapezoid:
A trapezoid is a plan with only two parallel sides as shown in figure

Trapezoidal Rule:
Consider y = f[x] bounded by x=a to x=b. Than by definition integration of the function of x i.e. y w.r.t x is the area under the curve AB shown in figure y A A a h b B B x

Numerical Integration and the Trapezoidal rule Lecture Notes. GC university Faisalabad. By: S.M Alay-e-Abbas i.e. b Area = F[x] = a f[x] dx = a numerical value

now dividing the trapezoid into a Rectangle and an approximate triangle i.e number of rectangles n = 1 we can write F[x] = h f[a] + h {f[b] f [a]} = h {f[a] +1/2f[b] 1/2f[a]} = h/2 {f[a] + f[b]} = h/2 {f[x0] + f[x1]} for n = 2 we have two rectangles and two triangle such that the approximate area under the curve now become F[x] = h/2 {f[a] +f[{a+b}/2]}+ h/2 {f[{a+b}/2] + f[b]} = h/2 {f[a] + 2f[{a+b}/2] + f[b]} = h/2 {f[x0] + 2f[x1] + f[x2]} So generalizing for n divisions of the trapezoid we have F[x] = h/2 {f[x0] + 2f[x1] + 2f[x2] + + 2f[xn-2] + 2f[xn-a] + f[xn]} Is an approximation of of the integral of y = f[x]. Where h=ba n n can be even or odd. And approximation can be improved using large value of n. Q- For each of the following use trapezoidal rule with the specified value of n. Compare your result with the analytically calculated value y = x +1/x, Ix = [2,3], n = 10 y = 1/1+x4, Ix = [1,2], n = 12 y = 1/x, Ix = [1,2], n =10
Note: The Assignment/Report of the solutions of the above given problems should be submitted in hard copy form along with electronic programs used to calculate the approximations.

Numerical Integration and the Trapezoidal rule Lecture Notes. GC university Faisalabad. By: S.M Alay-e-Abbas MS Excel Example for finding the Numerical Values using Trapezoidal Rule

Here

The cells under f[x] are given the values = A#-2 The cells under X are given the values = A2 + 0.1 in the third cell i.e A3 because the first cell contains the initial value X0 = 1 which is at the cell A2 The formula is defined at the cell F21 and has been defined as =(0.1*0.5)*(B2+2*(SUM(B3:B21))+B22)

Anda mungkin juga menyukai