Gaussian Quad

download Gaussian Quad

of 12

Transcript of Gaussian Quad

  • 8/11/2019 Gaussian Quad

    1/12

    GaussianGaussian QuadraturesQuadratures 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=1m cif(xi)

    A formula with m function evaluations requires specification of2m numbers ci andxi

    Gaussian Quadratures select both these weights and locations so that a higher order

    polynomial can be integrated (alternatively the error is proportionalto 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]

  • 8/11/2019 Gaussian Quad

    2/12

    Gaussian Quadrature on [-1, 1]

    Two function evaluations:

    Choose (c1, c2, x1, x2) such that the method yields exactintegral for f(x) = x0, x1, x2, x3

    )x(fc)x(fc)x(fc)x(fcdx)x(f nn2211i1

    1

    n

    1i

    i

    =

    L

    )f(xc)f(xc

    f(x)dx:2n

    2211

    1

    1

    =

    x2x1-1 1

  • 8/11/2019 Gaussian Quad

    3/12

    Finding quadrature nodes and weights

    One way is through the theory of orthogonal

    polynomials.

    Here we will do it via brute force Set up equations by requiring that the 2mpoints

    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

  • 8/11/2019 Gaussian Quad

    4/12

    Gaussian Quadrature onGaussian Quadrature on [[--1, 1]1, 1]

    Exact integral forf = x0, x1, x2, x3

    Four equations for four unknowns

    )f(xc)f(xcf(x)dx:2n 22111

    1

    =

    =

    =

    =

    3

    1x

    3

    1x

    1c

    1c

    xcxc0dxxxf

    xcxc3

    2dxxxf

    xcxc0xdxxf

    cc2dx11f

    2

    1

    2

    1

    3

    22

    3

    1

    1

    1 1

    33

    2

    22

    2

    1

    1

    11

    22

    221

    1

    1 1

    2

    1

    11

    )3

    1(f)

    3

    1(fdx)x(fI

    1

    1

  • 8/11/2019 Gaussian Quad

    5/12

    Error

    If we approximate a function with a Gaussian quadrature

    formula we cause an error proportional to 2n th

    derivative

  • 8/11/2019 Gaussian Quad

    6/12

    Gaussian Quadrature onGaussian Quadrature on [[--1, 1]1, 1]

    Choose (c1, c2, c3, x1, x2, x3) such that the methodyields exact integral forf(x) = x0, x1, x2,x3,x4, x5

    )x(fc)x(fc)x(fcdx)x(f:3n 3322111

    1

    x3x1-1 1x2

  • 8/11/2019 Gaussian Quad

    7/12

    Gaussian Quadrature onGaussian Quadrature on [[--1, 1]1, 1]

    5

    33

    5

    22

    5

    11

    1

    1

    55

    433

    422

    411

    1

    1

    44

    3

    33

    3

    22

    3

    11

    1

    1

    33

    2

    33

    2

    22

    2

    11

    1

    1

    22

    332211

    1

    1

    321

    1

    1

    0

    52

    0

    3

    2

    0

    21

    xcxcxcdxxxf

    xcxcxcdxxxf

    xcxcxcdxxxf

    xcxcxcdxxxf

    xcxcxcxdxxf

    cccxdxf

    ++===

    ++===

    ++===

    ++===

    ++===

    ++===

    =

    =

    =

    =

    =

    =

    5/3

    0

    5/3

    9/5

    9/8

    9/5

    3

    2

    1

    3

    2

    1

    x

    x

    x

    c

    c

    c

  • 8/11/2019 Gaussian Quad

    8/12

    Gaussian Quadrature onGaussian Quadrature on [[--1, 1]1, 1]

    Exact integral forf = x0, x1, x2, x3,x4, x5

    )5

    3(f9

    5)0(f9

    8)5

    3(f9

    5dx)x(fI1

    1

  • 8/11/2019 Gaussian Quad

    9/12

    Gaussian Quadrature onGaussian Quadrature on [a, b][a, b]

    Coordinate transformation from [a,b] to [-1,1]

    t2t1a b

    ==

    1

    1

    1

    1

    b

    adx)x(gdx)

    2

    ab)(

    2

    abx

    2

    ab(fdt)t(f

    =

    =

    =

    bt1xat1x

    2

    abx

    2

    abt

  • 8/11/2019 Gaussian Quad

    10/12

    Example: Gaussian QuadratureExample: Gaussian Quadrature

    Evaluate

    Coordinate transformation

    Two-point formula

    33.34%)(543936.3477376279.3468167657324.9

    e)3

    44(e)

    3

    44()

    3

    1(f)

    3

    1(fdx)x(fI 3

    44

    3

    441

    1

    =

    =

    926477.5216dtteI 40

    t2=

    + =+==

    =+=++=

    1

    1

    1

    1

    444

    0

    2 )()44(

    2dxdt;2222

    dxxfdxexdtteI

    xabxabt

    xt

  • 8/11/2019 Gaussian Quad

    11/12

    Example: Gaussian QuadratureExample: Gaussian QuadratureThree-point formula

    Four-point formula

    4.79%)(106689.4967

    )142689.8589(9

    5)3926001.218(

    9

    8)221191545.2(

    9

    5

    e)6.044(95e)4(

    98e)6.044(

    95

    )6.0(f9

    5)0(f

    9

    8)6.0(f

    9

    5dx)x(fI

    6.0446.04

    1

    1

    =

    %)37.0(54375.5197

    )339981.0(f)339981.0(f652145.0

    )861136.0(f)861136.0(f34785.0dx)x(fI1

    1

    =

  • 8/11/2019 Gaussian Quad

    12/12

    Other rules

    Gauss-Lobatto:

    requiring end points be included in the formula

    Gauss-Radau Require one end point be in the formula