19
www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Embed Size (px)

Citation preview

Page 1: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

www.le.ac.uk

Numerical Methods: Integration

Department of MathematicsUniversity of Leicester

Page 2: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Content

Motivation

Mid-ordinate rule

Simpson’s rule

Page 3: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Reasons for Numerical Integration

• The function could be difficult or impossible to integrate

• The function may have been obtained from data, and the function may not be known

• We can program a computer to approximate any integral using numerical integration

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Page 4: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Numerical Integration: Mid-ordinate rule• The Mid-ordinate rule is a numerical way

of finding the area under a curve, by dividing the area into rectangles

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Page 5: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Numerical Integration: Mid-ordinate rule

h

𝑦 1

A B

𝑦 𝑛

Mid-ordinate rule

Simpson’s rule

Motivation

Next

Page 6: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

• The value of h is calculated using the limits A and B and n = the number of strips we want to divide the area into

• We then calculate the height of each rectangle by evaluating the function at the midpoint

Numerical Integration: Mid-ordinate rule

Mid-ordinate rule

Simpson’s rule

Motivation

Next

Page 7: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

• So the area under the curve is approximately:

Numerical Integration: Mid-ordinate rule

(h× 𝑦1 )+ (h× 𝑦2 )+…+(h× 𝑦𝑛 )=h(𝑦1+𝑦2+…+𝑦 𝑛)

Mid-ordinate rule

Simpson’s rule

Motivation

Next

Page 8: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Numerical Integration: Mid-ordinate rule

Example: Estimate using the Mid-ordinate

rule with 10 strips

Mid-ordinate rule

Simpson’s rule

Motivation

Next

Page 9: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Firstly, we calculate the width of the strips

Numerical Integration: Mid-ordinate rule

1.010

01

h

Mid-ordinate rule

Simpson’s rule

Motivation

Next

Page 10: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Numerical Integration: Mid-ordinate rule

x y Evaluate

0.05 y1 1.05127

0.15 y2 1.16834

0.25 y3 1.28403

0.35 y4 1.41907

0.45 y5 1.56831

0.55 y6 1.73325

0.65 y7 1.91554

0.75 y8 2.11700

0.85 y9 2.33965

0.95 y10 2.58571

TOTAL 17.18217

Mid-ordinate rule

Simpson’s rule

Motivation

Next

Page 11: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Using the formula we get

Numerical Integration: Mid-ordinate rule

7182.1)18217.17(1.0

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Page 12: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

42-1 0 531

Mid-Ordinate Rule

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Integrate from to sin x

x^2 - 5x + 10 Draw this graph

Split Into Strips

Find midpoints

Show areas required

Change step size

Start Again

Step 1:

Step 2:

Step 3:

Step 4:

Step size:

Page 13: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Numerical Integration: Simpson’s rule• Simpson’s rule is a form of numerical

integration which uses quadratic polynomials

....

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Page 14: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

• We then approximate the areas of the pairs of strips in the following way

Numerical Integration: Simpson’s rule

13h [ (𝑦 0+𝑦𝑛 )+4 ( 𝑦1+𝑦 3+…+𝑦𝑛−1 )+2 (𝑦 2+𝑦4+…+𝑦𝑛− 2) ]

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Page 15: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Example: Estimate using Simpson’s rule

with 10 strips

Numerical Integration: Simpson’s rule

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Page 16: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Numerical Integration: Simpson’s rule x y First and

LastOdd Even

0 1

0.1 1.010

0.2 1.040

0.3 1.094

0.4 1.173

0.5 1.284

0.6 1.433

0.7 1.632

0.8 1.896

0.9 2.247

1 2.718

TOTAL

3.718 7.268 5.544 Next

Mid-ordinate rule

Simpson’s rule

Motivation

Page 17: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

Using the formula, we get

Numerical Integration: Simpson’s rule

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Page 18: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester

42-1 0 531

Simpson’s Rule

Next

Mid-ordinate rule

Simpson’s rule

Motivation

Integrate from to sin x

x^2 - 5x + 10 Draw this graph

Split Into Strips

Find y values

Add values together

Change Number Of Strips

Start Again

Step 1:

Step 2:

Step 3:

Step 4:

Number of strips: (must be even)

Page 19: Www.le.ac.uk Numerical Methods: Integration Department of Mathematics University of Leicester