CINT2 Tchebyshev Integration 06/08/03

Total Page:16

File Type:pdf, Size:1020Kb

CINT2 Tchebyshev Integration 06/08/03

0dee323f77c962480e5809930f3a243e.doc Tchebyshev integration 04/05/18 1

the interval runs from -infinity to plus infinity in the case of Objective Hermite polynomials. It can be made 1 in the case of Legendre polynomials. In this lecture, I intend to demonstrate that Gauss Tchebyshev Integration the "best" rule for the second mu integral of simple three-d integration. It is "best" because the weights are Tchebyshev Polynomials equal and because the values of xi are easily found and varied. It The Tchebyshev polynomial has the property that it is is better than mid-point trapezoidal rule for integration regions in always less than or equal to 1. which the derivatives of the end points differ. It superiority to T (x)  cos(ncos1 (x)) mid-point trap is primarily due to the fact that the points are more n so that closely spaced at the ends than in the mid-region. It shares with mid-point trap the fact that the integrand never needs to be T0 (x)  cos(0)  1 evaluated at either end. 1 T1 (x)  cos(cos (x))  x 1 An expansion in orthogonal T2 (x)  cos(2cos (x)) polynomials  2cos2 (cos1 (x))  1 Last time we found that a periodic function, 2   2x  1 This means that the in the expansion. funbxg  c j expdi jxiin the interval (-1,1) has an  N 1  0 1 funbxg  c j Tj bxg c j Tj bxg  c j Tj bxg integral given by fun(x)dx  2c0 . We also found that the j0 j0 j N z1 error in a mid-point trap rule estimate of this function is the error in approximating the function is approximately equal  the last term dropped. A good rule of thumb is to assume that it is less than the last term held. There is a sub industry called  N  2 cmN . This says that the integration error is m1 Chebyshev economization in which a polynomial expansion is approximately equal to 2cN which is the 2N+1 'th coefficient in a made about xi which is more accurate than needed near xi in Fourier expansion of the function. For N on the order of 100 or order to maximize its range. It is then re-expanded as a the so this allows fun to be rather well represented by this expansion. above. The coefficients larger than those needed for the desired The coefficients can be found by utilizing the orthogonality over accuarcy are dropped. Then the series is rewritten as a lower this interval to arrive at order polynomial. 1  1 funbxgexp  ikx dx  c j exp ibj  kgx dx Evaluating the integrals for the z1 d i z1 d i j0 coefficients (and finding w(x))   c 2  2c The orthogonality condition is  j jk k 1 j0 w(x)T x T x dx    The Fourier expansion is limited to periodic functions, but any z j bgk bg j j,k function can be expanded as 1  1 fun x  c P x w(x) cos( j cos1 (x)) cos(k cos1 (x))dx    bg j j bg z j j,k j0 1 If the P's are orthogonal in the sense that Change variables to 1 y  cos1 x ; x  cos y ; wbxgPj bxgPk bxgdx   j kj bg bg z1 Then dx   sinbygdy   1 cos2 byg  1 x 2  1 1 So that the condition becomes funbxgwbxgPx bxgdx  c j wbxgPk bxgPj bxgdx z1 z1 0 j0  w(x) 1 x 2 cos( jy) cos(ky)dy     z j j,k    c j k  jk   k ck j0 Thus define w(x)  1/ 1 x 2 Equation 1 to find The function w(x) is at our disposal. It can be made exponential  so that the interval can go from 0 to infinity in the case of cos( jy) cos(ky)dy    z j j,k Laguerre polynomials. It can be made a exp(-alpha x*x) so that 0 0dee323f77c962480e5809930f3a243e.doc Tchebyshev integration 04/05/18 2

This yields A1PN (x1 )PN (x1 )  A2 PN (x1 )PN (x2 ) ⋯  0   1 / 2 j 0  A P (x )P (x )  w(x)P 2 (x)dx  j    N N 1 N N  N Note that the expansion coefficients in the series are given by 1 equation 1 as which for the set of xi’s at the zeroes of PN(x) is as wrong as it 1 can be. This is the same as found for periodic functions in  k ck  fun x w x Tx x dx the last lecture. The conclusion is that 1 bgbgbg z N  1 1 1 wbxgf bxgdx   Ai f bxi g  fun x cos k cos x dx z bg c bgh i1 z1 1 x 2 where the xi's are the zeroes of PN(x), and the Ai's in general which seems to be a somewhat nasty integral, especially if one need to be solved for. Codes for finding these are in Press wants to use an end point method to evaluate it. As above and should be used on a second pass. 1 change variables to y  cos bxg; x  cosbyg so that 1 20 Gauss Legendre f bxgdx   Ai f bxi g 1 1 z1 dy  d cos (x)  dx i1 1 x 2 X=+-value A, N=20 same for +- values This simplifies the integral for the coefficients to 0.9931285992 0.01761400714  0.9639719273 0.04060142980  k ck  funccosbygcosbkygdy 0.9122344283 0.06267204833 z0 h 0.8391169718 0.08327674158 0.7463319065 0.1019301198 Gauss Quadrature 0.6360536807 0.1181945320 The function of interest is 0.5108670020 0.1316886384 0.3737060887 0.1420961093 fun(x)  c j Pj (x) j 0.2277858511 0.1491729865 The sum in principle includes an infinite number of terms. The 0.07652652113 0.1527533871 integral is The 21 point one counts the central point only once 1 N 1 21 Gauss Legendre f x dx  A f x  w( x ) f ( x )dx  c0   Ai f ( xi ) bg  i bi g z1 1 i1 i1 and the obgect is to find A’s and xi’s such that the error appears X=+-value A, N=20 same for +- values in as high a cj as possible. For the first N terms 0.9937521706 0.01601722826 1 0.9672268386 0.03695378977 A1 P0  A2 P0 ⋯ AN P0   w( x )P0dx 0.9200993342 0.05713442542 1 0.8533633646 0.07610011363 A P  x   A x ⋯ A x  0 0.7684399635 0.09344442346 1 1 1 2 2 N N 0.6671388041 0.1087972992 ⋯ 0.5516188359 0.1218314161 A P ( x )  A P ( x )⋯ A P ( x )  0 0.4243421202 0.1322689386 1 N 1 1 2 N 1 2 N N 1 N 0.2880213168 0.1398873948 as long as the xi are at distinct locations it is a simple matter of 0.1455618542 0.1445244040 solving the N simultaneous equations for the N values of A . i 0.00000 0.1460811336 Then the N+1’st equation is simply ⋯ The reason that there are two tables, one with 20 and one with 21 A1 PN ( x1 ) A2 PN ( x2 )  AN PN ( xN )  0 terms, is that integral should always be evaluated with both. solve this one by letting xi be the N zeroes of PN(x), which for a When the values are the same, this says that the 41 and 43 terms positive definite w(x) can be shown to all lie between 0 and 1. in the expansion of the function are both effectively zero and that Now look at the the answer is correct. When the answers are different, neither N+2 nd equation should be trusted. Note that the weights at the ends are much A1 PN 1( x1 ) A2 PN 1( x2 )⋯ AN PN 1( xN )  0 smaller than those in the middle and that the points at the ends and note that by adding just the correct amounts of the first N are much closer spaced than the ones in the middle. equations, this can be factored into

A1P1 (x1 )PN (x1 )  A2 P1 (x1 )PN (x2 ) ⋯ Gauss Tchebyshev Quadrature

 AN P1 (x1 )PN (xN )  0 The desired integral is 1 1 Which is also solved by this same set of xi’s. Continuing with funbxg this the last 2N+1 th equation however becomes funbxgdx  wbxg dx  2c0 z1 z1 wbxg 0dee323f77c962480e5809930f3a243e.doc Tchebyshev integration 04/05/18 3

The zeroes of the N'th Tchebyshev polynomial occur at the h=3.1415927/50 The above analysis shows that points where open(1,file='test.pts') a mid-point trap rule of T (x )  cos(N cos1 (x ))  0 do i=1,50 Equation 3 is much more N i i y=h*(i-.5) accurate, than a mid point trap This requires x=cos(y) rule of equation 4. I used the  N cos1 (x )  i f=x**4 simple code to the left to i 2 write(1,*)x,f generate the data plotted in

Recall of course that we need to have xi between -1 and 1 enddo figure 1.  close(1) cos1 (x )  i i 2N i  1/ 2 x  cosF b gI i HG N KJ The A's turn out to be constant =  / N as can easily be seen by letting fun = w so that 1 1 N dx   Ai z1 2 1 x i1 Let x  cosbg; dx   sinbgd so that 1 1 N 0 sin dx  Ai   d   1 2   2 z 1 x i1 z1 cos bg

In the more general case 1 funbxg w x dx  Figure 1 The points calculated in a Chebyshec evaluation of 1 bg z wbxg fun(x) = x4.  N i  1/ 2 F i  1/ 2 I The point is that sin(y) is the weight, and cos(y) for y spaced as a 1 cos2 F b gIfun cosF b gI  G J GG JJ mid-point trap rule is the set of yi's needed for a Gauss N i1 H N K H H N KK Tchebyshev integration. Equation 3 is more accurate than equation 4, because the end points which have data on only one  N i  1/ 2 F i  1/ 2 I  sinF b gIfun cosF b gI side are interpolated with a much closer spacing. N  G N J GG N JJ i1 H K H H KK Assignment Let fun=sin((/2)x*x) Equation 2 beg=0 end= 22 Wait a minute. That is Calculate the integral 22 to 6+ digit accuracy. Equation 2 is just a mid-point trap rule evaluation of [Abramowitz and Stegun give 0.567822]  I  sinbygfunbcos ygdy This is a maximum of the integral. This is a Fresnel z0 integral which arises in diffraction problems. It is also a chirp which arises when two stars collide. Equation 3 To get the most out of this assignment, use mid-point trap This can be arrived at beginning with rule and Gauss Tchebyshev with a varynig number of points. 1 Try to extrapotate to an infinite number of points. Also use I  funbxgdx 20 and 21 point Gauss quadrature. -- be sure to check for z1 type's both yours and mine. Equation 4 By changing variables to x  cosbyg; dx   sinbygdy 0 I   sinbygfunccosbyghdy z   sinbygfun cosbygdy z0 c h

Recommended publications