AOSC 652: Week 6, Day 2
-
Upload
khangminh22 -
Category
Documents
-
view
2 -
download
0
Transcript of AOSC 652: Week 6, Day 2
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
Numerical Integration
Week 6, Day 2
8 Oct 2014
Analysis Methods in Atmospheric and Oceanic Science
AOSC 652
1
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Also known as “quadrature”
In numerical analysis, a quadrature rule is a method for evaluatinga definite integral of a function, usually stated as a weighted sum of the
function values evaluated a specified points within the domain of integration.
Many of the classic algorithms assume thatthe value of the function is known at equally spaced points.
If a climate model is devised using altitude as the vertical coordinate,Then integrals wrt height could possibly be evaluated using a classic algorithms
(i.e., Simpson’s Rule).
If a climate model is devised using pressure as the vertical coordinate,then integrals wrt height can be must be evaluated using a technique
designed for unequally spaced points (Trapezoidal Rule, Gaussian Integration)
2
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Simpson’s Rule:
Trapezoidal Rule:
Will work for evenly OR unevenly spaced grid and any N
Classic method will work only for evenly spaced grid and odd N
[ ]
1
1
2
2 11, 3, 5
where = ( ) /
( ) ( ) + 4 ( ) ( )3
−
+ +=
−
≈ +Σ∫N
NNx
i i ix i
h x x N
hf x dx f x f x f x
[ ]1
1
11
1( )( ) ( ) + ( )
2
−
+=
+ −≈ Σ∫
NNx
i ix i
iix xf x dx f x f x
3
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Simpson’s Rule:
Trapezoidal Rule:
Will work for evenly OR unevenly spaced grid and any N
Classic method will work only for evenly spaced grid and odd N
[ ]
1
1
2
2 11, 3, 5
where = ( ) /
( ) ( ) + 4 ( ) ( )3
−
+ +=
−
≈ +Σ∫N
NNx
i i ix i
h x x N
hf x dx f x f x f x
Why bother with the more complicated Simpson’s rule ?
[ ]1
1
11
1( )( ) ( ) + ( )
2
−
+=
+ −≈ Σ∫
NNx
i ix i
iix xf x dx f x f x
4
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
[ ]
1
1
2
2 11, 3, 5
where = ( ) /
( ) ( ) + 4 ( ) ( )3
−
+ +=
−
≈ +Σ∫N
NNx
i i ix i
h x x N
hf x dx f x f x f x
1
1
44 3 2 1
1, 5, 9
where = ( ) /
14 ( ) + 64 ( ) 24 ( ) 64 ( ) + 14 ( ) ( )
45
−+ + + +
=
−
+ +≈ Σ∫
N
N
Nxi i i i i
xi
h x x N
f x f x f x f x f xf x dx h
Bode’s Rule: N must be evenly divisible by 5; based on 4th order Polynomials;Error order 6th derivative of f
[ ]
1
1
3
3 2 11, 4, 6
where = ( ) /
3( ) ( ) 3 ( ) 3 ( ) + ( ) 8
−
+ + +=
−
≈ + +Σ∫N
NNx
i i i ix i
h x x N
hf x dx f x f x f x f x
Simpson’s Rule: N must be odd (or need work around); based on 3d order polynomialsError order 4th derivative of f
Simpson’s 3/8 Rule: N must be evenly divisible by 4; also based on 3d order polynomialsError order 4th derivative of f
5
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
All of these routines require even grid spacing !
[ ]
1
1
2
2 11, 3, 5
where = ( ) /
( ) ( ) + 4 ( ) ( )3
−
+ +=
−
≈ +Σ∫N
NNx
i i ix i
h x x N
hf x dx f x f x f x
1
1
44 3 2 1
1, 5, 9
where = ( ) /
14 ( ) + 64 ( ) 24 ( ) 64 ( ) + 14 ( ) ( )
45
−+ + + +
=
−
+ +≈ Σ∫
N
N
Nxi i i i i
xi
h x x N
f x f x f x f x f xf x dx h
Bode’s Rule: N must be evenly divisible by 5; based on 4th order Polynomials;Error order 6th derivative of f
[ ]
1
1
3
3 2 11, 4, 6
where = ( ) /
3( ) ( ) 3 ( ) 3 ( ) + ( ) 8
−
+ + +=
−
≈ + +Σ∫N
NNx
i i i ix i
h x x N
hf x dx f x f x f x f x
Simpson’s Rule: N must be odd (or need work around); based on 3d order polynomialsError order 4th derivative of f
Simpson’s 3/8 Rule: N must be evenly divisible by 4; also based on 3d order polynomialsError order 4th derivative of f
6
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
y1, y2, … yn nodes are not uniformly spacedc1, c2, … cn Gauss coefficients are determined once n is specified
Nice descriptions of theory at http://en.wikipedia.org/wiki/Gaussian_quadratureand http://www.efunda.com/math/num_integration/num_int_gauss.cfm
( )n1
1i=1
1 ( ) = ( ( )) ( ( )) 2
b
i ia
dxf x dx f g y dy b a c f g ydy−
≈ − ∑∫ ∫
Note:
produces exact result for polynomials of degree 3 or less
1
1
3 3( ) 3 3−
−≈ +
∫ f y dy f f
7
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Simpson’s Rule:
Trapezoidal Rule:
Will work for evenly OR unevenly spaced grid and any N
Classic method will work only for evenly spaced grid and odd N
[ ]
1
1
2
2 11, 3, 5
where = ( ) /
( ) ( ) + 4 ( ) ( )3
−
+ +=
−
≈ +Σ∫N
NNx
i i ix i
h x x N
hf x dx f x f x f x
[ ]1
1
11
1( )( ) ( ) + ( )
2
−
+=
+ −≈ Σ∫
NNx
i ix i
iix xf x dx f x f x
8
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Simpson’s Rule:
Trapezoidal Rule:
Will work for evenly OR unevenly spaced grid and any N
Classic method will work only for evenly spaced grid and odd N
[ ]
1
1
2
2 11, 3, 5
where = ( ) /
( ) ( ) + 4 ( ) ( )3
−
+ +=
−
≈ +Σ∫N
NNx
i i ix i
h x x N
hf x dx f x f x f x
However, we’ve written a version of Simpson’s Rulethat will work for either even or odd N
[ ]1
1
11
1( )( ) ( ) + ( )
2
−
+=
+ −≈ Σ∫
NNx
i ix i
iix xf x dx f x f x
9
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Simpson’s Rule:
Trapezoidal Rule:
Will work for evenly OR unevenly spaced grid and any N
Classic method will work only for evenly spaced grid and odd N
[ ]
1
1
2
2 11, 3, 5
where = ( ) /
( ) ( ) + 4 ( ) ( )3
−
+ +=
−
≈ +Σ∫N
NNx
i i ix i
h x x N
hf x dx f x f x f x
We’re now going to examine the Trapezoidal Rule & Simpson’s Rule using“data files” of Y vs X, based on the evaluation of several analytic functions”
[ ]1
1
11
1( )( ) ( ) + ( )
2
−
+=
+ −≈ Σ∫
NNx
i ix i
iix xf x dx f x f x
10
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Simpson’s Rule:
Trapezoidal Rule:
Will work for evenly OR unevenly spaced grid and any N
Classic method will work only for evenly spaced grid and odd N
[ ]
1
1
2
2 11, 3, 5
where = ( ) /
( ) ( ) + 4 ( ) ( )3
−
+ +=
−
≈ +Σ∫N
NNx
i i ix i
h x x N
hf x dx f x f x f x
We’re now going to examine the Trapezoidal Rule & Simpson’s Rule using“data files” of Y vs X, based on the evaluation of several analytic functions”
Why do you think we are going to use “analytic functions”?
[ ]1
1
11
1( )( ) ( ) + ( )
2
−
+=
+ −≈ Σ∫
NNx
i ix i
iix xf x dx f x f x
11
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Please copy files:
~rjs/aosc652/week_06/data_generate.f and~rjs/aosc652/week_06/data_integrate.f
to your work area.
Numerical Integration
12
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
We’re going to use four “analytic functions” to generate “data files” of Y vs X,which we will then integrate:
1 1 2
0 0 1 = 1 ( ) 3 =∫ ∫Integral Function x dx x dx
1 1 4
0 0 2 = 2 ( ) 5 =∫ ∫Integral Function x dx x dx
1 1 8
0 0 3 = 3 ( ) 9 =∫ ∫Integral Function x dx x dx
1 1 12
0 0 4 = 4 ( ) 13 =∫ ∫Integral Function x dx x dx
13
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
What do these functions look like?
Compile code data_generate.f, run using “100” for number of intervals,and plot resulting functions using:
Black for Function 1; Blue for Function 2;Green for Function 3; Red for Function 4
We’re going to use four “analytic functions” to generate “data files” of Y vs X,which we will then integrate:
1 1 2
0 0 1 = 1 ( ) 3 =∫ ∫Integral Function x dx x dx
1 1 4
0 0 2 = 2 ( ) 5 =∫ ∫Integral Function x dx x dx
1 1 8
0 0 3 = 3 ( ) 9 =∫ ∫Integral Function x dx x dx
1 1 12
0 0 4 = 4 ( ) 13 =∫ ∫Integral Function x dx x dx
14
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC1 2
0Black : 3 ∫ x dx
1 4
0Blue : 5 ∫ x dx
1 8
0Green : 9 ∫ x dx
1 12
0Red : 13 ∫ x dx
NPTS = 101
15
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Why did I write NPTS = 101 ?
1 2
0Black : 3 ∫ x dx
1 4
0Blue : 5 ∫ x dx
1 8
0Green : 9 ∫ x dx
1 12
0Red : 13 ∫ x dx
NPTS = 101
16
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Why did I write NPTS = 101 ?What is the numerical value of these “definite integrals”?
1 2
0Black : 3 ∫ x dx
1 4
0Blue : 5 ∫ x dx
1 8
0Green : 9 ∫ x dx
1 12
0Red : 13 ∫ x dx
NPTS = 101
17
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration: Let’s fill in the following tables:
a) Run program data_generate.e to generate “fn_for_integration*.dat”files, for 25, 10, and 6 intervals (in addition to the file for 100 intervalsyou should have already generated)
b) Compile code data_integrate.f
c) Run program data_integrate.e to complete table
18
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
19
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration: Let’s fill in the following tables:
a) Run program data_generate.e to generate “fn_for_integration*.dat”files, for 25, 10, and 6 intervals (in addition to the file for 100 intervalsyou should have already generated)
b) Compile code data_integrate.f
c) Run program data_integrate.e to complete table
20
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
21
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005
5 x4
9 x8
13 x12
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
22
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005
5 x4 1.00017
9 x8
13 x12
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
23
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005
5 x4 1.00017
9 x8 1.00060
13 x12
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
24
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005
5 x4 1.00017
9 x8 1.00060
13 x12 1.00130
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
25
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080
5 x4 1.00017
9 x8 1.00060
13 x12 1.00130
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
26
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080
5 x4 1.00017 1.00267
9 x8 1.00060
13 x12 1.00130
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
27
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080
5 x4 1.00017 1.00267
9 x8 1.00060 1.00959
13 x12 1.00130
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
28
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080
5 x4 1.00017 1.00267
9 x8 1.00060 1.00959
13 x12 1.00130 1.02074
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
29
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500
5 x4 1.00017 1.00267
9 x8 1.00060 1.00959
13 x12 1.00130 1.02074
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
30
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500
5 x4 1.00017 1.00267 1.01665
9 x8 1.00060 1.00959
13 x12 1.00130 1.02074
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
31
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500
5 x4 1.00017 1.00267 1.01665
9 x8 1.00060 1.00959 1.05958
13 x12 1.00130 1.02074
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
32
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500
5 x4 1.00017 1.00267 1.01665
9 x8 1.00060 1.00959 1.05958
13 x12 1.00130 1.02074 1.12766
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
33
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665
9 x8 1.00060 1.00959 1.05958
13 x12 1.00130 1.02074 1.12766
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
34
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958
13 x12 1.00130 1.02074 1.12766
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
35
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
36
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
37
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2
5 x4
9 x8
13 x12
38
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.
5 x4
9 x8
13 x12
39
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.
5 x4 1.
9 x8
13 x12
40
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.
5 x4 1.
9 x8 1.
13 x12
41
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.
5 x4 1.
9 x8 1.
13 x12 1.
42
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003
5 x4 1.
9 x8 1.
13 x12 1.
43
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003
5 x4 1. 1.
9 x8 1.
13 x12 1.
44
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003
5 x4 1. 1.
9 x8 1. 1.00004
13 x12 1.
45
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003
5 x4 1. 1.
9 x8 1. 1.00004
13 x12 1. 1.00024
46
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1.
5 x4 1. 1.
9 x8 1. 1.00004
13 x12 1. 1.00024
47
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1.
5 x4 1. 1. 1.
9 x8 1. 1.00004
13 x12 1. 1.00024
48
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1.
5 x4 1. 1. 1.
9 x8 1. 1.00004 1.00164
13 x12 1. 1.00024
49
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1.
5 x4 1. 1. 1.
9 x8 1. 1.00004 1.00164
13 x12 1. 1.00024 1.00875
50
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1. 1.
5 x4 1. 1. 1.
9 x8 1. 1.00004 1.00164
13 x12 1. 1.00024 1.00875
51
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1. 1.
5 x4 1. 1. 1. 1.00051
9 x8 1. 1.00004 1.00164
13 x12 1. 1.00024 1.00875
52
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1. 1.
5 x4 1. 1. 1. 1.00051
9 x8 1. 1.00004 1.00164 1.01212
13 x12 1. 1.00024 1.00875
53
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1. 1.
5 x4 1. 1. 1. 1.00051
9 x8 1. 1.00004 1.00164 1.01212
13 x12 1. 1.00024 1.00875 1.05807
54
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1.00005 1.00080 1.00500 1.01389
5 x4 1.00017 1.00267 1.01665 1.04617
9 x8 1.00060 1.00959 1.05958 1.16347
13 x12 1.00130 1.02074 1.12766 1.34357
Numerical Integration: Let’s fill in the following tables:Trapezoidal Rule:
Simpson’s Rule:
Function 100 intervals
25 intervals
10 intervals
6 intervals
3 x2 1. 1.00003 1. 1.
5 x4 1. 1. 1. 1.00051
9 x8 1. 1.00004 1.00164 1.01212
13 x12 1. 1.00024 1.00875 1.05807
55
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
Trapezoidal Rule:
Simpson’s Rule:
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
Let’s conduct a graphical analysisto investigate behavior of integrationby Trapezoidal rule and Simpson’s rule:
a) focus first on the 6 interval calculationof function = 13x12
b) what should we plot ?!?
56
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
Trapezoidal Rule:
Simpson’s Rule:
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
Let’s conduct a graphical analysisto investigate behavior of integrationby Trapezoidal rule and Simpson’s rule:
a) focus first on the 6 interval calculationof function = 13x12
b) what should we plot ?!?
57
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
Trapezoidal Rule:
Simpson’s Rule:
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
Let’s conduct a graphical analysisto investigate behavior of integrationby Trapezoidal rule and Simpson’s rule:
a) focus first on the 6 interval calculationof function = 13x12
b) what should we plot ?!?
58
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
Trapezoidal Rule:
Simpson’s Rule:
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
Let’s conduct a graphical analysisto investigate behavior of integrationby Trapezoidal rule and Simpson’s rule:
a) focus first on the 6 interval calculationof function = 13x12
b) what should we plot ?!?
59
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
Trapezoidal Rule:
Simpson’s Rule:
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.163471.059581.009591.000609 x8
1.12766
1.01665
1.00500
10 intervals
1.343571.020741.0013013 x12
1.046171.002671.000175 x4
1.013891.000801.000053 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
1.012121.001641.000041.9 x8
1.00875
1.
1.
10 intervals
1.058071.000241.13 x12
1.000511.1.5 x4
1.1.000031.3 x2
6 intervals
25 intervals
100 intervals
Function
Let’s conduct a graphical analysisto investigate behavior of integrationby Trapezoidal rule and Simpson’s rule:
a) focus first on the 6 interval calculationof function = 13x12
b) what should we plot ?!?
60
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
Air Quality Model Satellite Data
For which model NO2 profile did Tim check the details of his integration scheme ?
61
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
Air Quality Model Satellite Data
“If the function you propose to integrate is sharply concentrated in one or more peaks, or if the shape is not readily characterized by a single length-scale, then” you should be concerned about the accuracy of your integration scheme.
62
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
n1
1i=1
( ) ( )i if y dy c f y−
≈ ∑∫
Nice description of theory at http://en.wikipedia.org/wiki/Gaussian_quadrature
63
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
n1
1i=1
( ) ( )i if y dy c f y−
≈ ∑∫
Theory based on limits always being from −1 to 1
Nice description of theory at http://en.wikipedia.org/wiki/Gaussian_quadrature
64
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
n1
1i=1
( ) ( )i if y dy c f y−
≈ ∑∫
Theory based on limits always being from −1 to 1
Problem of course is limits we care about are usually not −1 to 1 !
Nice description of theory at http://en.wikipedia.org/wiki/Gaussian_quadrature
65
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
n1
1i=1
( ) ( )i if y dy c f y−
≈ ∑∫
Theory based on limits always being from −1 to 1
Problem of course is limits we care about are usually not −1 to 1 !
Who we gonna call ?
Nice description of theory at http://en.wikipedia.org/wiki/Gaussian_quadrature
66
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
n1
1i=1
( ) ( )i if y dy c f y−
≈ ∑∫
Nice description of theory at http://en.wikipedia.org/wiki/Gaussian_quadrature
Theory based on limits always being from −1 to 1
Problem of course is limits we care about are usually not −1 to 1 !
Who we gonna call ?
67
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
n1
1i=1
( ) = ( ( )) ( ( )) b
i ia
dx dxf x dx f g y dy c f g ydy dy−
≈
∑∫ ∫
To use Gaussian Quadrature for the evaluation of integrals with arbitrary limits,
must execute a Variable Transformation
( ) is a linear function: i.e., g(y)=Intercept + Slope y, that relates to 1 and to 1= = − = =
g yx a y x b y
68
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
n1
1i=1
( ) = ( ( )) ( ( )) b
i ia
dx dxf x dx f g y dy c f g ydy dy−
≈
∑∫ ∫
To use Gaussian Quadrature for the evaluation of integrals with arbitrary limits,
must execute a Variable Transformation
( )
( )
Can show:1 Slope = 2
1 Intercept = 2
b a
b a
−
+
( ) is a linear function: i.e., g(y)=Intercept + Slope y, that relates to 1 and to 1= = − = =
g yx a y x b y
69
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
( ) ( )1 1 where ( ) = + y 2 2
g y b a b a+ −
( )n1
1i=1
1 ( ) = ( ( )) ( ( )) 2
b
i ia
dxf x dx f g y dy b a c f g ydy−
≈ − ∑∫ ∫
See http://en.wikipedia.org/wiki/Gaussian_quadrature
70
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
y1, y2, … yn nodes are not uniformly spacedc1, c2, … cn Gauss coefficients are determined once n is specified
( )n1
1i=1
1 ( ) = ( ( )) ( ( )) 2
b
i ia
dxf x dx f g y dy b a c f g ydy−
≈ − ∑∫ ∫
See http://en.wikipedia.org/wiki/Gaussian_quadrature
Location of nodes yi (places where the function is evaluated)and weights ci both vary as a function of n
71
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature:
http://www.efunda.com/math/num_integration/findgausslaguerre.cfmprovides Gaussian nodes and weights as a function of n
72
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
73
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCGaussian Quadrature:
1
1
3 3( ) 3 3−
−≈ +
∫ f y dy f f
1 2 1 23 3Where do weights of 1 ; 1 and nodes of ; come from ?
3 3
c c y y −
= = = =
74
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCGaussian Quadrature:
1 2 1 21
1 1 2 21
12 3 2 3
1 0 1 1 2 1 3 1 2 0 1 2 2 2 3 21
0
Four unknowns: , , ,
Assume: ( ) c ( ) ( ) is exact for polynomials up to order 3
Then: ( ) = ( ) + ( )
Or:
c c y y
f y dy f y c f y
f y dy c a a y a y a y c a a y a y a y
a dy
−
−
−
≈ +
+ + + + + +
∫
∫
1 1
0 1 2 0 1 1 1 2 2 11 1
1 12 2 2 3 3 3
2 2 1 1 2 2 2 3 1 1 2 2 31 1
2 ( ) 0 ( )
2 ( ) 0 ( ) 3
a c c a a y dy c y c y a
a y dy a c y c y a a y dy c y c y a
−
− −
= = + = = +
= = + = = +
∫ ∫
∫ ∫
75
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCGaussian Quadrature:
1 2 1 21
1 1 2 21
12 3 2 3
1 0 1 1 2 1 3 1 2 0 1 2 2 2 3 21
0
Four unknowns: , , ,
Assume: ( ) c ( ) ( ) is exact for polynomials up to order 3
Then: ( ) = ( ) + ( )
Or:
c c y y
f y dy f y c f y
f y dy c a a y a y a y c a a y a y a y
a dy
−
−
−
≈ +
+ + + + + +
∫
∫
1 1
1 2 1 1 1 2 21 1
1 12 2 2 3 3 3
2 1 1 2 2 3 1 1 2 21 1
0 0 1
2 2 3
2 ( ) 0 ( )
2 ( ) 0 ( ) 3
c c a y dy c y c y
a y dy c y c y a y dy c y
a a a
a a c y a
−
− −
= = + = = +
= = + = = +
∫ ∫
∫ ∫
1 2 1 2Four equations, four unknowns: , , , c c y y
76
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCGaussian Quadrature:
1 2 1 21
1 1 2 21
12 3 2 3
1 0 1 1 2 1 3 1 2 0 1 2 2 2 3 21
0
Four unknowns: , , ,
Assume: ( ) c ( ) ( ) is exact for polynomials up to order 3
Then: ( ) = ( ) + ( )
Or:
c c y y
f y dy f y c f y
f y dy c a a y a y a y c a a y a y a y
a dy
−
−
−
≈ +
+ + + + + +
∫
∫
1 1
1 2 1 1 1 2 21 1
1 12 2 2 3 3 3
2 1 1 2 2 3 1 1 2 21 1
0 0 1
2 2 3
2 ( ) 0 ( )
2 ( ) 0 ( ) 3
c c a y dy c y c y
a y dy c y c y a y dy c y
a a a
a a c y a
−
− −
= = + = = +
= = + = = +
∫ ∫
∫ ∫
1 2 1 23 3
3 3Solution: =1 =1 =, , , c c y y− =
77
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSCNumerical Integration
Gaussian Quadrature: we would like to fill in the following table:Function 2 nodes 10 nodes Error,
10 nodes3 x2
5 x4
9 x8
13 x12
a) Assignment #6, part 1: Start with ~rjs/aosc/week_06/gauss_integrate.f
b) A few lines in subroutines fn1, fn2, fn3, and fn4 need to be completed
These lines relate variables x and y, as well as dx/dy, where x is thedependent variable used for our functions so far today (limits of 0 to 1) &y is the dependent variable for Gaussian integration (limits of −1 to 1)
Once these lines are filled in, the cells in the table can be populated
78
Copyright © 2014 University of Maryland.This material may not be reproduced or redistributed, in whole or in part, without written permission from Ross Salawitch. 8 Oct 2014
AOSC 652: Analysis Methods in AOSC
Calculation of multi-dimensional integrals adds additional level of complexity
IDL and Matlab have various tools for the evaluation of integrals of data:• good for you, the user, to understand how these tools work !• pay attention to:
− grid spacing: are grid pts evenly spaced?should they be evenly spaced?should they be “linear”?how does integrand vary relative to grid points?
− number of points:some methods place strict limits on “mod N”may need to modify IDL or MATLAB integration toolcode to properly handle end points
79