+ All Categories
Home > Documents > Lecture 009

Lecture 009

Date post: 03-Apr-2018
Category:
Upload: mahmoud-el-mahdy
View: 225 times
Download: 0 times
Share this document with a friend

of 23

Transcript
  • 7/29/2019 Lecture 009

    1/23

    Numerical Integration 1.0.1 Error Estimations for Trapezoidal Rule

    In the preceding section, numerical results for all integrands but one showed a

    regular behavior in the error for both trapezoidal and Simpson rules. To explain

    this regular behavior we consider error formulas for these integration methods.

    These formulas will lead to a better understanding of the methods, showing

    both their weakness and strengths, and they will allow improvements of the

    methods. We begin by examining the error of the trapezoidal rule.

    Theorem 0.0. Trapezoidal Error Estimation

    Let f+x/ have two continuous derivatives on #a, b', and let n be a positiveinteger. Then for the error in integrating

    I+f/ a

    bf+x/ x

    using the trapezoidal rule Tn+f/ of (0.XXX), we have

    En

    T

    +f

    / I

    +f

    / T

    n+f

    /

    h2+b a/12

    f''

    +cn/

    The numbercn is some unknown point in #a, b', and h +b a/ sn.Formula (0.0) can be used to bound the error in Tn+f/, generally by boundingthe term f'' +cn/ by its largest possible value on the interval #a, b'. This will beillustrated in the following example. Also note that the formula forEn

    T+f/ isconsistent with the behavior of the error observed in the calculations (examine

    this).

    Example 0.0. Error Estimation

    Recall the examples we discussed in the previous section, with

    I 0

    1 1

    1 xx ln+2/.

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    2/23

    Solution 0.7. Here f+x/ 1 s +1 x/, #a, b' #0, 1', and f'' +x/ 2 t +1 x/3.Substituting into the error formula (0.0), we obtain

    En

    T

    +f/ h2

    12 f'' +cn/ 0 cn 1, h 1 s n.The formula cannot be computed exactly because cn is not known. But we can

    bound the error by looking at the largest possible value for f'' +cn/ . Boundf'' +x/ on #a, b' #0, 1'

    max0x12

    +1 x/3 2.

    Then

    EnT+f/ h

    2

    12+2/ h

    2

    6.

    Forn 1 and n 2, we have

    E1T+f/ 1

    6and E2

    T+f/ +1 s 2/2

    6.

    Comparing these results with the true errors, we see that these bounds are two

    to three times the actual errors.

    A possible weakness in the trapezoidal rule can be inferred from the

    assumptions of Theorem 0.0. Iff+x/ does not have two continuous derivativeson #a, b', then does Tn+f/ converge more slowly? The answer is yes for somefunctions, especially if the first derivative is not continuous.

    The error formula (0.0) can only be used to bound the error, because f'' +cn/ isunknown. This will be improved on by a more careful consideration of the error

    formula.

    A central element of our proof of (0.0) leis in being able to demonstrate the

    n 1 case for an interval #, h':

    hf+x/ xh% f+/ f+ h/

    2) h

    3

    12f'' +c/

    2 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    3/23

    for some c in #, h'. We will use this formula to obtain the general formula(0.0) in Theorem 0.0.

    Recall the derivation of the trapezoidal rule Tn+f/ as given in (0.XXX). ThenEnT+f/

    a

    bf+x/ x Tn+f/

    x0

    xnf+x/ xTn+f/

    i0

    n1

    xi

    xi1f+x/ xh f+xi/ f+xi1/.

    Apply (0.0) to each of the terms on the right side of (0.0), to obtain

    EnT+f/ h

    3

    12i1

    n

    f'' +i/.

    The unknown constants 1, 2, , n are located in the respective subintervals

    #x0, x1', #x1, x2', #xn1, xn'. By factoring (0.0), we obtain

    EnT+f/ h

    2

    12i1

    n

    h f'' +i/.

    The sum in (0.0) is equal to +b a/ f'' +cn/ for some cn #a, b', thus obtainingthe general case of (0.0).

    To estimate the trapezoidal error, observe that the term of the sum in (0.0) is a

    Riemann sum for the integral

    a

    bf'' +x/ x f' +b/ f' +a/.

    The Riemann sum is based on the partition of#a, b' as n , this sum willapproach the integral (0.0). Using (0.0) to estimate the right side of (0.0), we

    find that

    EnT+f/ h2

    12#f' +b/ f' +a/'.

    This error estimate will be denoted EnT+f/. It is called the asymptotic estimate of

    the error because it improves as n increases. As long as f' +x/ is computableEnT+f/ will be very easy to be derived.

    Lecture_009.nb 3

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    4/23

    Example 0.0. Error Estimation for Trapezoidal Rule

    Again consider the case

    I 01 1

    1 xx.

    Solution 0.8. Then f' +x/ 1 t +1 x/2 and (0.0) yields the estimate

    EnT+f/ h

    2

    12% 1+1 1/2

    1

    +1 0/2 ) h2

    16with h

    1

    n.

    Forn 1 and n 2

    E

    1T+f/ 1

    16 0.0625

    E

    2T+f/ 1

    64 0.0156

    These compare quite closely to the true errors calculated above.

    The estimate EnT+f/ has several practical advantages over the earlier error

    formula (0.0). First, it confines that when n is doubled the error decreases by a

    factor of about 4, provided that f' +b/ f' +a/ 0. This agrees with the results forour calculations in Example 0.XXX. Second (0.0) implies that the convergenceofTn+f/ will be more rapid when f' +b/ f' +a/ 0. This is a partial explanation ofthe very rapid convergence observed in the third integral in Example 0.XXX.

    Finally, (0.0) leads to a more accurate numerical integration formula by taking

    EnT+f/ into account:

    I+f/ Tn+f/ h2

    12+f' +b/ f' +a//

    which can be write as

    I+f/ Tn+f/ h2

    12+f' +b/ f' +a//.

    This formula is called the corrected trapezoidal rule, and it will be denoted by

    4 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    5/23

    CTn+f/. This correction needs an extension of our formula defined above. Thefollowing lines define the extension of the formula.

    correctedTrapezoidalMethod#f_, x_, a_, b_, n_' :Block%h,

    h +b a/sn;fp xf;

    trapezoidalMethod#f, x, a, b, n' h2

    12++fp s. x! b/ +fp s. x ! a//

    )

    Example 0.0. Application of CTn+f/Let us evaluate the integral

    I 0

    1

    x2x 0.746824

    and compare it with different orders of approximations by Tn+f/ and CTn+f/.Solution 0.9. The exact value of this integral is

    I0 0

    1

    x2

    x

    1

    2 erf+1/

    where Erf+1/ is the so called error function at 1. Using the numerical proceduresforTn+f/ and CTn+f/ for orders of

    n 2, 4, 8, 16, 32, 64, 128, 256, 512;then the trapezoidal method delivers the results

    Lecture_009.nb 5

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    6/23

    Tn -trapezoidalMethod-x2 , x, 0, 1, 11 &1 s n

    0.73137, 0.742984, 0.745866, 0.746585,0.746764, 0.746809, 0.74682, 0.746823, 0.746824

    For the corrected trapezoidal method the results are

    CTn -correctedTrapezoidalMethod-x2, x, 0, 1, 11 &1 s n

    0.746699, 0.746816, 0.746824, 0.746824,0.746824, 0.746824, 0.746824, 0.746824, 0.746824

    The errors of the two methods are

    1 I0 Tn

    0.0154539, 0.00384004, 0.000958518, 0.000239536, 0.0000598782,0.0000149692, 3.74227 106, 9.35566 107, 2.33891 107

    2 I0 CTn

    0.000125571, 7.9575 106, 4.98589 107, 3.11797 108, 1.949 109,1.21817 1010, 7.61358 1012, 4.75842 1013, 2.9643 1014

    The following table collects these information

    6 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    7/23

  • 7/29/2019 Lecture 009

    8/23

    EnT+f/ I+f/ Tn+f/ h

    2+b a/12

    f'' +cn/

    The numbercn is some unknown point in #a, b', and h +b a/ sn.Formula (0.0) can be used to bound the error in Tn+f/, generally by boundingthe term f'' +cn/ by its largest possible value on the interval #a, b'. This will beillustrated in the following example. Also note that the formula forEn

    T+f/ isconsistent with the behavior of the error observed in the calculations (examine

    this).

    Example 0.0. Error Estimation

    Recall the examples we discussed in the previous section, with

    I 0

    1 1

    1 xx ln+2/.

    Solution 0.7. Here f+x/ 1 s +1 x/, #a, b' #0, 1', and f'' +x/ 2 t +1 x/3.Substituting into the error formula (0.0), we obtain

    EnT+f/ h

    2

    12f'' +cn/ 0 cn 1, h 1 s n.

    The formula cannot be computed exactly because cn is not known. But we canbound the error by looking at the largest possible value for f'' +cn/ . Boundf'' +x/ on #a, b' #0, 1'

    max0x12

    +1 x/3 2.

    Then

    EnT+f/ h2

    12 +2/ h2

    6.

    Forn 1 and n 2, we have

    E1T+f/ 1

    6and E2

    T+f/ +1 s 2/2

    6.

    8 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    9/23

    Comparing these results with the true errors, we see that these bounds are two

    to three times the actual errors.

    A possible weakness in the trapezoidal rule can be inferred from the

    assumptions of Theorem 0.0. Iff

    +x

    /does not have two continuous derivatives

    on #a, b', then does Tn+f/ converge more slowly? The answer is yes for somefunctions, especially if the first derivative is not continuous.

    The error formula (0.0) can only be used to bound the error, because f'' +cn/ isunknown. This will be improved on by a more careful consideration of the error

    formula.

    A central element of our proof of (0.0) leis in being able to demonstrate the

    n 1 case for an interval #, h':

    hf+x/ xh% f+/ f+ h/

    2) h

    3

    12f'' +c/

    for some c in #, h'. We will use this formula to obtain the general formula(0.0) in Theorem 0.0.

    Recall the derivation of the trapezoidal rule Tn+f/ as given in (0.XXX). ThenEnT+f/

    a

    bf+x/ x Tn+f/

    x0

    xnf+x/ xTn+f/

    i0

    n1

    xi

    xi1f+x/ xh f+xi/ f+xi1/.

    Apply (0.0) to each of the terms on the right side of (0.0), to obtain

    EnT+f/ h

    3

    12i1

    n

    f'' +i/.

    The unknown constants 1, 2, , n are located in the respective subintervals

    #x0, x1', #x1, x2', #xn1, xn'. By factoring (0.0), we obtainEnT+f/ h

    2

    12i1

    n

    h f'' +i/.

    The sum in (0.0) is equal to +b a/ f'' +cn/ for some cn #a, b', thus obtainingthe general case of (0.0).

    Lecture_009.nb 9

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    10/23

    To estimate the trapezoidal error, observe that the term of the sum in (0.0) is a

    Riemann sum for the integral

    abf''

    +x

    /x f'

    +b

    / f'

    +a

    /.

    The Riemann sum is based on the partition of#a, b' as n , this sum willapproach the integral (0.0). Using (0.0) to estimate the right side of (0.0), we

    find that

    EnT+f/ h

    2

    12#f' +b/ f' +a/'.

    This error estimate will be denoted EnT

    +f

    /. It is called the asymptotic estimate of

    the error because it improves as n increases. As long as f' +x/ is computableEnT+f/ will be very easy to be derived.

    Example 0.0. Error Estimation for Trapezoidal Rule

    Again consider the case

    I 0

    1 1

    1 xx.

    Solution 0.8. Then f' +x/ 1 t +1 x/2 and (0.0) yields the estimate

    EnT+f/ h

    2

    12% 1+1 1/2

    1

    +1 0/2 ) h2

    16with h

    1

    n.

    Forn 1 and n 2

    E

    1T+f/ 1

    16 0.0625

    E

    2T+f/ 1

    64 0.0156

    These compare quite closely to the true errors calculated above.

    The estimate EnT+f/ has several practical advantages over the earlier error

    10 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    11/23

    formula (0.0). First, it confines that when n is doubled the error decreases by a

    factor of about 4, provided that f' +b/ f' +a/ 0. This agrees with the results forour calculations in Example 0.XXX. Second (0.0) implies that the convergence

    ofTn+f/ will be more rapid when f' +b/ f' +a/ 0. This is a partial explanation ofthe very rapid convergence observed in the third integral in Example 0.XXX.Finally, (0.0) leads to a more accurate numerical integration formula by taking

    EnT+f/ into account:

    I+f/ Tn+f/ h2

    12+f' +b/ f' +a//

    which can be write as

    I+f/ Tn+f/ h2

    12 +f' +b/ f' +a//.This formula is called the corrected trapezoidal rule, and it will be denoted by

    CTn+f/. This correction needs an extension of our formula defined above. Thefollowing lines define the extension of the formula.

    correctedTrapezoidalMethod#f_, x_, a_, b_, n_' :Block%h,

    h

    +ba/sn

    ;

    fp xf;

    trapezoidalMethod#f, x, a, b, n' h2

    12++fp s. x! b/ +fp s. x ! a//

    )

    Example 0.0. Application of CTn+f/

    Let us evaluate the integral

    I 0

    1

    x2x 0.746824

    and compare it with different orders of approximations by Tn+f/ and CTn+f/.Solution 0.9. The exact value of this integral is

    Lecture_009.nb 11

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    12/23

    I0 0

    1

    x2

    x

    1

    2 erf+1/where Erf+1/ is the so called error function at 1. Using the numerical proceduresforTn+f/ and CTn+f/ for orders of

    n 2, 4, 8, 16, 32, 64, 128, 256, 512;then the trapezoidal method delivers the results

    Tn -trapezoidalMethod-x2 , x, 0, 1, 11 &1 s n

    0.73137, 0.742984, 0.745866, 0.746585,0.746764, 0.746809, 0.74682, 0.746823, 0.746824

    For the corrected trapezoidal method the results are

    CTn

    -correctedTrapezoidalMethod-x2

    , x, 0, 1,

    11 &1 s

    n

    0.746699, 0.746816, 0.746824, 0.746824,0.746824, 0.746824, 0.746824, 0.746824, 0.746824

    The errors of the two methods are

    1 I0 Tn

    0.0154539, 0.00384004, 0.000958518, 0.000239536, 0.0000598782,0.0000149692, 3.74227 106, 9.35566 107, 2.33891 107

    12 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    13/23

    2 I0 CTn

    0.000125571, 7.9575 106, 4.98589 107, 3.11797 108, 1.949 109,1.21817 1010, 7.61358 1012, 4.75842 1013, 2.9643 1014

    The following table collects these information

    Prepend#Transpose#n, H1, H2, H2 s RotateLeft#H2'',"n", "H1", "H2", "Ratio"' ss TableForm

    n 1 2 Ratio

    2 0.0154539 0.000125571 15.7802

    4 0.00384004 7.9575 106 15.968 0.000958518 4.98589 107 15.9908

    16 0.000239536 3.11797 108 15.9978

    32 0.0000598782 1.949 109 15.9994

    64 0.0000149692 1.21817 1010 16.

    128 3.74227 106 7.61358 1012 16.0002

    256 9.35566 107 4.75842 1013 16.0524

    512 2.33891 107 2.9643 1014 2.36065 1010

    The table shows that the corrected trapezoidal converges quite rapidly

    compared with the conventional method Tn+f/. When n is doubled the error inCTn+f/ decreases by a factor of about 16.1.0.2.0 Error Formulas for Simpson's Rule

    The type of analysis used in the preceding discussion can also be used to

    derive corresponding error formulas for Simpson's rule. These are stated in the

    following theorem, with the proof omitted.

    Theorem 0.0. Error for Simpson's Rule

    Assume f+x/ has four continuous derivatives on #a, b', and let n be an evenpositive integer. Then the error in using Simpson's rule is given by

    Lecture_009.nb 13

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    14/23

    EnS+f/ I+f/ Sn+f/ h

    4+b a/180

    f+4/+cn/

    with cn an unknown point in #a, b' and h +b a/ s n. Moreover, this error can beestimated with the asymptotic error formula

    EnS+f/ h

    4

    180+f''' +b/ f''' +a//.

    Note that (0.0) say that Simpson's rule is exact for all f+x/ that are polynomialsof degree 3, whereas the quadratic interpolation on which Simpson's rule is

    based is exact only forf+x/ a polynomial of degree 2. The degree of precisionbeing 3 leads to the powerh4 in the error, rather than the powerh3, which

    would have been produced on the basis of the error in quadratic interpolation. It

    is this higher powerh4 in the error and the simple form of the method that

    historically have caused Simpson's rule to be the most popular numerical

    integration rule.

    Example 0.0. Error in Simpson's Rule

    Estimate the error for the integral

    I 0

    1 1

    1 xx

    by applying Simpson's error formula.

    Solution 0.10. First let us define the function and the derivatives of third and

    fourth order

    f+x_/ : 1x 1

    f3

    3 f+x/xxx

    6

    +x 1/4

    14 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    15/23

    f4 4 f+x/

    xxxx

    24

    +x 1/5The exact error is given by

    EnS+f/ h

    4

    180f+4/+cn/, h 1

    n

    for some 0 cn 1. We can bound it by

    1

    180,h40 f4 s.x 0

    2 h415

    The asymptotic error is given by

    a 1

    180,h40 ++f3 s.x 1/ +f3 s.x 0//

    h4

    32

    Now if we set n 2, E

    2S+f/ 0.00195; for comparison the actual error resulting

    from the calculations by applying Simpson's rule is 0.001308.

    The behavior in I+f/ Sn+f/ can be derived from (0.0). When n is doubled, h ishalved, and h4 decreases by a factor of 16. Thus, the errorEn

    S+f/ shoulddecrease by the same factor, provided that f''' +b/ f''' +a/. This is the errorbehavior observed in Example 0.0.The theory of asymptotic error formulas

    En+f/ En+f/

    Lecture_009.nb 15

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    16/23

    such as forEnT+f/ and EnT+f/, says that (0.0) is valid provided that

    limnE

    n+f/En

    +f

    / 1.

    The needed size ofn in (0.0) will vary with the integrand f, which is illustrated

    by Example 0.0. From (0.0) and (0.0), we also are lead to infer that Simpson's

    rule will not perform as well iff+x/ is not four times continuously differentiableon #a, b'. This is correct for most such functions, and other numerical methodsare often necessary for integrating them.

    Example 0.0. Simpson's Rule with Slow Convergence

    Use Simpson's Rule to approximate

    I 0

    1x x

    2

    3.

    Solution 0.11. The integration for different orders of iteration is done by

    S2 .simpsonMethod. x , x, 0 , 1, 12 &2 s2, 4, 8, 16, 32, 64, 128, 256, 512, 1024

    {0.638071, 0.656526, 0.663079, 0.665398, 0.666218, 0.666508, 0.666611,0.666647, 0.66666, 0.666664}

    The error of the numerical integration with respect to the exact value is

    2

    3 S2

    0.0285955, 0.0101404, 0.00358739, 0.00126848, 0.000448484, 0.000158564,0.0000560607, 0.0000198205, 7.00759 106, 2.47756 106

    The ratio of two consequent values is determined by

    ratio

    RotateLeft#'{2.81996, 2.82668, 2.8281, 2.82837, 2.82842, 2.82843, 2.82843, 2.82843,

    2.82843, 0.0000866416}

    16 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    17/23

    The error and the ratio of the errors is collected in the following table

    Prepend[Transpose[{{2, 4, 8, 16, 32, 64, 128, 256, 512, 1024}, , ratio}], {"n",

    "", "Ratio"}] // TableForm

    "n" "" "Ratio"

    2 0.0285955 2.81996

    4 0.0101404 2.82668

    8 0.00358739 2.8281

    16 0.00126848 2.82837

    32 0.000448484 2.82842

    64 0.000158564 2.82843

    128 0.0000560607 2.82843

    256 0.0000198205 2.82843

    512 7.00759 106 2.82843

    1024 2.47756 106 0.0000866416

    The column Ratio shows that the convergence is much slower.

    As was done by the trapezoidal rule, a corrected Simpson's rule can be defined:

    CSn+f/ Sn+f/ h4

    180+f''' +b/ f''' +a//.

    This will be usually a more accurate approximation than Sn+f/. The correctedSimpson's rule can be implemented by the following lines

    correctedSimpsonsMethod#f_, x_, a_, b_, n_' :Block%h,

    h +b a/sn;fp x,x,xf;

    simpsonMethod

    #f,

    x, a, b

    , n

    '

    h4

    180++fp s. x! b/ +fp s. x ! a//

    )

    Example 0.0. Application of CSn+f/

    Lecture_009.nb 17

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    18/23

    Let us evaluate the integral

    I 0

    1

    x2x 0.746824

    and compare it with different orders of approximations by Sn+f/ and CSn+f/.Solution 0.12. The exact value of this integral formula

    I0 0

    1

    x2x

    1

    2 erf+1/

    where Erf+1/ is the so called error function at 1. Using the numerical proceduresforSn+f/ and CSn+f/ for orders ofn = {2, 4, 8, 16, 32, 64, 128, 256, 512};

    Then the trapezoidal method delivers the results

    Sn .simpsonMethod.x2 , x, 0 , 1, 12 &2 s n{0.74718, 0.746855, 0.746826, 0.746824, 0.746824, 0.746824, 0.746824,

    0.746824, 0.746824}

    For the corrected trapezoidal method the results are

    CSn .correctedSimpsonsMethod.x2 , x, 0 , 1, 12 &2 s n{0.746669, 0.746823, 0.746824, 0.746824, 0.746824, 0.746824, 0.746824,

    0.746824, 0.746824}

    The errors of the two methods are

    1 = I0 - Sn

    0.000356296, 0.000031247, 1.98772 106,1.24623 107, 7.79456 109, 4.87245 1010,

    3.04541 1011, 1.90337 10

    12, 1.19016 1013

    18 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    19/23

    2 = I0 - CSn

    0.000154648, 6.87001 107, 8.15866 109, 1.18803 1010,1.82354 1012, 2.84217 1014, 5.55112 1016, 0., 0.

    The following table collects these information

    Prepend[Transpose[{n, 1, 2, 2/RotateLeft[2]}], {"n", "1", "2", "Ratio"}] //

    TableForm

    "n" "1" "2" "Ratio"

    2 0.000356296 0.000154648 225.105

    4 0.000031247 6.87001 107 84.205

    8 1.98772 106 8.15866 109 68.6738

    16 1.24623 107 1.18803 1010 65.1497

    32 7.79456 109 1.82354 1012 64.1602

    64 4.87245 1010 2.84217 1014 51.2

    128 3.04541 1011 5.55112 1016 ComplexInfinity

    256 1.90337 1012 0. Indeterminate

    512 1.19016 1013 0. 0.

    The table shows that the corrected Simpson's converges quite rapidly

    compared with the conventional method Sn+f/. When n is doubled the error inCSn+f/ decreases by a factor of about 68.

    1.1 Gaussian Numerical Integration

    The numerical methods studied in the last section were based on integrating

    linear and quadratic interpolating polynomials, and the resulting formulas were

    applied on subdivisions of ever smaller subintervals. In this section, weconsider a numerical method that is based on the exact integration of

    polynomials of increasing degree; no subdivision of the integration interval is

    used. To motivate this approach, recall from Section 2.4 of Chapter 2 the

    material on approximation of functions.

    Let f+x/ be continuous on #a, b'. Then n+f/ denotes the smallest error boundthat can be attained in approximating f+x/ with a polynomial pn+x/ of degree n

    Lecture_009.nb 19

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    20/23

    on the given interval a x b. The polynomial pn+x/ that yields thisapproximation is called the minimax approximation of degree n forf+x/,maxaxb f+x/ pn+x/ n+f/and n+f/ is called the minimax error. From Theorem 3.1 of Chapter 3, it can beseen that n+f/ will often converge to zero quite rapidly.If we have a numerical integration formula to integrate low- to moderate-degree

    polynomials exactly, then the hope is that the same formula will integrate other

    functions f+x/ almost exactly, iff+x/ is well approximated by such polynomials.To illustrate the derivation of such integration formulas, we restrict our attention

    to the integral

    I+f/ 11

    f+x/ x.Its relation to integrals over other intervals #a, b' will be discussed later.The integration formula is to have the general form

    In+f/ j1

    n

    wj f,xj0

    and we require that the nodes

    x

    1, , x

    nand weights

    w

    1, , w

    nbe so

    chosen that In+f/ I+f/ for all polynomials f+x/ of as large a degree as possible.Case n 1 The integration formula has the form

    1

    1f+x/ x w1 f+x1/.

    It is to be exact for polynomials of as large a degree as possible.

    Using f+x/ 1 and forcing equality in (0.0) gives us2 w1.

    Now use f+x/ xand again force equality in (0.0). Then0 w1 x1

    which implies x1 0. Thus (0.0) becomes

    20 Lecture_009.nb

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    21/23

    1

    1f+x/ x 2 f+0/ I1+f/.

    This is the midpoint formula from the trapezoidal approximation. The formula

    (0.0) is exact for all linear polynomials.

    To see that (0.0) is not exact for quadratics, let f+x/ x2. Then the error in (0.0)is given by

    1

    1x

    2x 2 +0/2 2

    3 0.

    Case n 2 The integration formula is

    11

    f+x/ x w1 f+x1/ w2 f+x2/.and it has four unspecified quantities: x1, x2, w1, and w2. To determine these,

    we require it to be exact for the four monomials

    f+x/ 1, x, x2, x3.This leads to the four equations

    2 w1 w2

    0 w1 x1 w2 x22

    3 w1 x1

    2 w2 x22

    0 w1 x13 w2 x2

    3

    This is a nonlinear system in four unknowns;

    Lecture_009.nb 21

    2012 G. Baumann

  • 7/29/2019 Lecture 009

    22/23

  • 7/29/2019 Lecture 009

    23/23

    calculation to not be exact for the degree 4 polynomial f+x/ x4. Thus I2+f/ hasdegree of precision 3.

    For cases n 3 there occurs a problem in the solution for the weights and the

    interpolation points because the determining system of equations becomes

    nonlinear. The following function generates the determining equations for a

    Gau integration.

    gaussIntegration#f_, x_, a_, b_, n_' : Block%,varsX

    Table#ToExpression#StringJoin#"x", ToString#i''',i, 1, n';

    varsW

    Table#ToExpression#StringJoin#"w", ToString#i''',i, 1, n';

    vec1 Table$varsXi, i, 0, 2 n 1(;

    vecB Table%If%EvenQ#i', Abs% 22 i 1

    ), 0),

    i, 0, 2 n 1);equations Thread#Map#varsW. &, vec1' vecB'

    )

    soli gaussIntegration#f, x, a, b, 3' ss TableForm

    w1 w2 w3 m 2

    w1 x1 w2 x2 w3 x3 m 0

    w1 x12 w2 x2

    2 w3 x3

    2m

    2

    3

    w1 x13 w2 x2

    3 w3 x3

    3m 0

    w1 x14 w2 x2

    4 w3 x3

    4m

    2

    7

    w1 x15 w2 x25 w3 x35 m 0

    We clearly observe that the equations are nonlinear due to the fact that the xiare not specified yet. The problem here is that there exist no reliable procedure

    to find the solutions for nonlinear algebraic equations.

    Lecture_009.nb 23


Recommended