+ All Categories
Home > Documents > Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE,...

Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE,...

Date post: 11-Jan-2016
Category:
Upload: adela-mcbride
View: 220 times
Download: 0 times
Share this document with a friend
38
Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1
Transcript
Page 1: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Today’s class

• Numerical Integration• Newton-Cotes

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

1

Page 2: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Discuss Mid-term Exam 1

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

2

0 10 20 30 40 50 60 70 80 90 1000

1

2

3

4

5

6

7

Average = 74.5, Standard dev = 17.6

Max = 98 Min = 35

Histogram of scores

Page 3: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Discuss Mid-term Exam 1

1 (30) Use Taylor series to approximate at x=0.5 until t 1%, using a base point x=0. (Use 4 significant digits with rounding, and the true value is 0.4055)

 

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

3

Page 4: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Discuss Mid-term Exam 1

2 (30) Use the false-position method with initial guesses of 50 and 70 to determine x to a level of a 0.5%. (Use 4 significant digits with rounding)

 

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

4

351653.0135

xex

Page 5: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Discuss Mid-term Exam 1

3 (20) Use the Newton-Raphson method with an initial guess of 6 to determine a root of the following function to a level of a 0.01% (use 4 significant digits with rounding)

 

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

5

05.045.51 32 xxx

Page 6: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Discuss Mid-term Exam 1

4 (20) Use the Gauss-Seidel method to solve the following linear equation system to a tolerance of s = 5% with a starting point (0, 0, 0).(Use 4 significant digits with rounding)

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

6

2028

3473

3862

321

321

321

xxx

xxx

xxx

Page 7: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Numerical Integration

• Numerical technique to solve definite integrals

• Find the area under the curve f(x) from a to b

• Another way to put it is that we need to solve the following differential equation

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

7

Page 8: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Numerical Integration• Where do we use numerical techniques?

• When you can’t integrate directly• When you have a sampling of points

representing f(x) as with the experiments results

• Graphical techniques• Grid approximation• Strip approximation

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

8

Page 9: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Graphical Techniques

• Grid approximation

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

9

Page 10: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Graphical Techniques

• Strip approximation

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

10

Page 11: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Numerical Integration

• Numerical techniques• Treat integral as a summation

• Basic idea is to convert a continuous function into discrete function

• The smaller the interval, the more accurate the solution but also at more computational expense

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

11

Page 12: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Numerical Integration

• Newton-Cotes formulas• Approximate function with a series of

polynomials that are easy to integrate

• Zero-order approximation is equivalent to strip approximation

• First order approximation is equivalent to trapezoidal approximation

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

12

Page 13: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Newton-Cotes Formulas

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

13

Page 14: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Newton-Cotes Formulas

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

14

Page 15: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

15

Page 16: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

16

Page 17: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

17

Page 18: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

• Evaluate integral• Analytical solution

• Trapezoidal solution

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

18

Page 19: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

19

Page 20: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

• Trapezoidal solution• To increase accuracy, shorten up the interval

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

20

Page 21: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

21

Page 22: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

• If you split the interval into n sub-intervals, each sub-interval has a width of h = (b – a)/n

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

22

Page 23: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

• More accurate as you increase n• Double n and reduce the error by a factor of

four

• However, if n is too large, you will start encountering round-off error and the integral solution can diverge

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

23

Page 24: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s Rules

• Second and third-order polynomial forms of the Newton-Cotes formulas

• Simpson’s 1/3 Rule• Use three points on the curve to form a second

order polynomial

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

24

Page 25: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s Rules

• Approximate the function by a parabola

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

25

Page 26: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s Rules

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

26

Page 27: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s Rules

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

27

Page 28: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s 1/3 Rule

• Error

• Multiple Application

• n must be even

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

28

Page 29: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s 3/8-Rule

• Approximate with a cubic polynomial

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

29

Page 30: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s 3/8-Rule

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

30

Page 31: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s 3/8-Rule

• Error

• Multiple Application

• n must be a multiple of 3

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

31

Page 32: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

32

Simpson’s 3/8-Rule

• Both the cubic and quadratic approximations are of the same order

• The cubic approximation is slightly more accurate then the quadratic approximation

• Usually not worth the extra work required• Only use the 3/8 rule if you need odd

number of segments• Can combine with 1/3 rule on some segments

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

32

Page 33: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Example

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

33

Page 34: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Integration with unequal segments• We have until now assumed that each

segment is equal• If we are integrating based on

experimental or tabular data, this assumption may not be true

• Newton-Cotes formulas can easily be adapted to accommodate unequal segments

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

34

Page 35: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoid Rule with Unequal Segments

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

35

Page 36: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Trapezoidal Rule

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

36

Page 37: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Simpson’s Rule with Unequal Segments

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

37

Page 38: Today’s class Numerical Integration Newton-Cotes Numerical Methods Lecture 12 Prof. Jinbo Bi CSE, UConn 1.

Next class

• Numerical Integration

• HW5 due Tuesday Oct 21

Numerical MethodsLecture 12

Prof. Jinbo BiCSE, UConn

38


Recommended