Вы находитесь на странице: 1из 12

Newton-Cotes Formulae

– use evenly-spaced functional values

– Did not use the flexibility we have to select the quadrature points

• In fact a quadrature point has several degrees of freedom.

Q(f)=i=1 m c f(x

i

)

i

A formula with m function evaluations requires specification of

2m numbers c i and x i

– select both these weights and locations so that a higher order polynomial can be integrated (alternatively the error is proportional to a higher derivatives)

• Price: functional values must now be evaluated at non- uniformly distributed points to achieve higher accuracy

• Weights are no longer simple numbers

• Usually derived for an interval such as [-1,1]

• Other intervals [a,b] determined by mapping to [-1,1]

 n 1 ∫ − 1 f ( x )dx ≈ ∑ c f ( x i i ) = c f ( x 1 1 ) + c 2 f ( x 2 ) + L + c n f ( x n )

i

= 1

• Two function evaluations:

– Choose (c1, c2, x1, x2) such that the method yields “exact integral” for f(x) = x 0 , x 1 , x 2 , x 3 1
n
=
2 :
f(x)dx
1
=
c f(x
)
+
c
f(x
)
1
1
2
2
-1
x 1
x 2
1

• One way is through the theory of orthogonal polynomials.

• Here we will do it via brute force

• Set up equations by requiring that the 2m points guarantee that a polynomial of degree 2m-1 is integrated exactly.

• In general process is non-linear

– (involves a polynomial function involving the unknown point and its product with unknown weight)

– Can be solved by using a multidimensional nonlinear solver

– Alternatively can sometimes be done step by step

n =

2 :

1

1

f(x)dx

=

c f(x

1

1

)

+

c

2

f(x

2

)

Exact integral for f = x 0 , x 1 , x 2 , x 3

Four equations for four unknowns

f

f

f

f

=

=

=

=

1

x

x

x

2

3

1

1

1

1

1dx

xdx

=

=

1

1

1

1

2

x dx

3

x dx

2

0

=

=

=

=

c

1

c

1

+

x

c

1

2

+

c

2

x

2 2
2
2
=
c
c
x
1 x
1 +
2
2
3
3
0
=
c
c
x
1 x
1 3 +
2
2

I

=

1

f ( x )dx
1

=

f ( 1
1
)
+
f (
)
3
3

Error

• If we approximate a function with a Gaussian quadrature formula we cause an error proportional to 2n th derivative

 1 ∫ − n = 3 : f ( x )dx 1 = c f ( x 1 1 ) + c 2 f ( x 2 ) + c 3 f ( x 3 ) x
-1
x 1
x 2
3 1

Choose (c 1 , c 2 , c 3 , x 1 , x 2 , x 3 ) such that the method yields “exact integral” for f(x) = x 0 , x 1 , x 2 , x 3 ,x 4 , x 5

f

f

f

f

f

f

= 1

1

xdx

= 2 =

c

1

+

c

2

+

c

3

1

1

1

= x

xdx

1

= =

0

c x

1

1

+

c x

2

2

+

c x

3

3

2 3

2

5

2 x dx

2

3

1

1

1

1

3

x dx

4 x dx

4

5

1

1

1

5

x dx

1 2 +

c x

2

2

2

= x

=

=

c x

1

+

c x

3

= =

0

c x

1

3

1

c x

2

3

2

c x

3

3

3

=

x

+

+

c x

1

4

1

c x

2

4

2

= x

=

=

+

+

c x

3

0

= =

c x

1

5

1

c x

2

5

2

c x

3

5

3

= ⇒

x

+

+

2

3

4

3

c

c

c

= 5/9

1

= 8/9

3 = 5/9

2

⇒ ⎨ 3/5
3/5

x =−

x

= 0

1

2

3

x =

Exact integral for f = x 0 , x 1 , x 2 , x 3, x 4 , x 5

I

=

1

f ( x )dx
1

= 5
3
5
3
f (
)
+
+
f (
9
5
8 f (0 )
9
)
9
5

Coordinate transformation from [a,b] to [-1,1] b − a
b + a
t =
x +
2
2
⎧ x
=− 1 ⇒ t =
a
x
= 1 ⇒
t
=
b
a
b
t 1
t 2
 ∫ b a ∫ 1 − 1 b − a b + a b − a ∫ 1 − 1 f ( t )dt = f ( x + )dx = )(

2

2

2

g( x )dx

4

0

2t

Evaluate

Coordinate transformation

I

te

dt

=

=

5216.926477 b − a
b + a
t =
x +
=
2
x +
2;
dt
=
2dx
2
2
2 t
4
x +
4
I =
∫ 4
te
dt
=
∫ 1
(4
x
+
4)
e
dx
=
∫ 1
f
(
x dx
)
0
− 1
− 1

Two-point formula 4
4
− 1
1
4
4 −
4
4 +
3
3
I
=
∫ 1
f ( x )dx
=
f (
)
+
f (
)
=
( 4
)e
+
( 4
+
)e
− 1
3
3
3
3
=
9.167657324
+
3468.376279
=
3477.543936
(
ε =
33.34%) Three-point formula
5
8
5
I =
∫ 1
f ( x )dx
=
f (
0.6 )
+
f (0 )
+
f (
0.6 )
− 1
9
9
9
5
8
5
4
0.6
4
4
=
(
4
4
0.6 )e
+
( 4 )e
+
( 4
+
4
0.6 )e
9
9
9

+ 0.6
 5 5 ( 2.221191545 ) + + 8 ( 218.3926001 ) 9 9 9 4967.106689 ( ε = 4.79%) 1 f ( x )dx = [ 0.34785 f ( − 0.861136 ) + + 0.652145 [ f ( − 0.339981 ) + = 5197.54375 ε =

1

(

( 8589.142689 )

=

=

Four-point formula

f ( 0.861136 )

]

f ( 0.339981 )

]

I =

0.37%)

• Gauss-Lobatto:

Other rules

– requiring end points be included in the formula