21
Trapezoidal Method

Presentation on Numerical Method (Trapezoidal Method)

Embed Size (px)

Citation preview

Trapezoidal Method

Acknowledgement

Md. Jashim Uddin

Assistant Professor

Dept. Of Natural Sciences

Dept. Of Computer Science and

Engineering

Daffodil International University

Content What is Trapezoidal Method

General Formula of Integration

How it works

History of Trapezoidal Method

Advantages

Application of Trapezoidal Rule

Example

Problem & Algorithm

C code for Trapezoidal Rule

Live Preview

Conclusion

References

Team : Root FinderGroup Member :

• Syed Ahmed Zaki ID:131-15-2169

• Fatema Khatun ID:131-15-2372

• Sumi Basak ID:131-15-2364

• Priangka Kirtania ID:131-15-2385

• Afruza Zinnurain ID:131-15-2345

What is Trapezoidal Method ?

In numerical analysis, the trapezoidal rule or method is a

technique for approximating the definite integral.

𝑥0𝑥𝑛

f(x) dx

It also known as Trapezium rule.

1

General Formula of Integration

In general Integration formula when n=1 its

Trapezoidal rule.

I=h[n𝑦0+ 𝑛2

2∆𝑦0+

2𝑛3−3𝑛2

12∆2𝑦0+

𝑛4−4𝑛3+4𝑛2

24∆3𝑦0 +⋯ ]

After putting n=1,

Trapezoidal Rule = ℎ

2[𝑦0 + 𝑦𝑛 + 2(𝑦1 + 𝑦2 + 𝑦3 +⋯ . 𝑦𝑛−1)]

2

How it works ?

Area A=𝑏1+𝑏2

2ℎ

Trapezoid is an one kind of rectangle which has 4 sides and minimum two sides are parallel

3

The trapezoidal rule works

by approximating the region

under the graph of the

function as a trapezoid and

calculating its area in limit.

It follows that,

𝑎𝑏

f(x) dx ≈ (b−a)2

[f(a) +f(b)]

4

The trapezoidal rule

approximation improves

With More strips , from

This figure we can clearly

See it

5

History Of Trapezoidal Method

• Trapezoidal Rule,” by Nick Trefethen and André Weideman. It deals with a fundamental and classical issue in numerical analysis—approximating an integral.

• By focusing on up-to-date covergence of recent results

Trefethen

6

There are many alternatives to the trapezoidal rule,

but this method deserves attention because of

• Its ease of use

• Powerful convergence properties

• Straightforward analysis

Advantages

7

Application of Trapezoidal Rule

• The trapezoidal rule is one of the family members of

numerical-integration formula.

• The trapezoidal rule has faster convergence.

• Moreover, the trapezoidal rule tends to become

extremely accurate than periodic functions

8

Example:

𝑥1 𝑥2 𝑥3=1 =5

1

5

1 + 𝑥2 𝑑𝑥

h = 5−1

4=1

Trapezoidal Rule = 1

2[ 𝑓(1) + 𝑓(5) + 2(𝑓(2) + 𝑓(3) + 𝑓(4)]

=2 =3 =4

= 1

2[ (1 + 12) + (1 + 52) + 2((1 + 22) + (1 + 32) + (1 + 42)]

= 1

2× 92

= 469

Problem & Algorithm

Problem: Here we have to find integration for the (1+𝑥2)dx with lower limit =1 to upper limit = 5

Algorithm:

Step 1: input a,b,number of interval n

Step 2: h=(b-a)/n

Step 3: sum=f(a)+f(b)

Step 4: If n=1,2,3,……i

Then , sum=sum+2*y(a+i*h)

Step 5: Display output=sum *h/2

10

C Code for Trapezoidal Method

#include<stdio.h>

float y(float x)

{

return (1+x*x);

}

int main()

{

float a,b,h,sum;

int i,n;

printf("Enter a=x0(lower limit), b=xn(upper limit), number of

subintervals: ");

11

scanf("%f %f %d",&a,&b,&n);

h=(b-a)/n;

sum=y(a)+y(b);

for(i=1;i<n;i++)

{

sum=sum+2*y(a+i*h);

}

printf("\n Value of integral is %f \n",(h/2)*sum);

return 0;

}

12

Live Preview

Live Preview of Trapezoidal Method

1

5

1 + 𝑥2 𝑑𝑥

Lower limit =1

Upper limit =5

Interval h=4

13

Conclusion

Trapezoidal Method can be applied accurately for

non periodic function, also in terms of periodic

integrals.

when periodic functions are integrated over their

periods, trapezoidal looks for extremely accurate.

14

Periodic Integral Function

http://en.wikipedia.org/wiki/Trapezoidal_rule

http://blogs.siam.org/the-mathematics-and-

history-of-the-trapezoidal-rule/

And various relevant websites

References

15

Thank You