RE: Problems with Legendre expansion

*To*: mathgroup at smc.vnet.net*Subject*: [mg24438] RE: [mg24402] Problems with Legendre expansion*From*: F.H.Simons at tue.nl*Date*: Tue, 18 Jul 2000 00:58:38 -0400 (EDT)*Sender*: owner-wri-mathgroup at wolfram.com

Kevin, I do not know why Mathematica is unable to do the integration with n=21. But we may help Mathematica a little by integrating term by term in the following way: n = 21; Integrate[ # Sin[Pi x]]& /@ LegendreP[n, x] // Expand With n=19, this command is more than twice as fast as the direct command Integrate[ Sin[Pi x] LegendreP[n, x], {x, -1, 1} ], and it also works fast for much higher values of n. Of course you can trust the numerical conversion of your exact result when working in high precision. That working in machineprecision fails is easy to see when you compute the numerical values of each of the terms in the exact result, e.g. by N[List @@ result] Many of the terms have an order of magnitude of 10^15, so that is is surprising that nevertheless the sum is close to 0. Regards, Fred Simons Eindhoven University of Technology