Re: Problems with Legendre expansion
- To: mathgroup at smc.vnet.net
- Subject: [mg24429] Re: [mg24402] Problems with Legendre expansion
- From: BobHanlon at aol.com
- Date: Tue, 18 Jul 2000 00:58:27 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 7/12/2000 11:41:42 PM, Kevin.McCann at jhuapl.edu writes: >I am doing a Legendre expansion of Sin[Pi x] and have, amongst others, >the following integral > >Integrate[Sin[Pi*x]*LegendreP[21,x],{x,-1,1}] > >Mathematica just returns the input with the polynomial expanded out. Now, >everything about the integral is exact. We have a 21st order polynomial >times the sine, and these integrals are all exact. Why no answer? This >same integral does work for the 19th and 20th Legendre functions. > >However, complications arise even for > >Integrate[Sin[Pi*x]*LegendreP[19,x],{x,-1,1}] > >Here I do get an exact answer with Pi's and large numbers, but when I do >N[%] on it, I get an answer of -0.000299144 which is way too large. If >instead I do N[%,30] on the exact, I get 10^(-14). Here is a work-around: soln21 = Integrate[Sin[Pi*x]*LegendreP[21, x], {x, -a, a}, Assumptions -> a > 0] /. a -> 1 // Simplify 1/Pi^21*2*(13113070457687988603440625 - 2025596249561559215165625*Pi^2 + 83648104232906493905625* Pi^4 - 1435402904039579475000*Pi^6 + 12196233825172897500*Pi^8 - 55437426478058625*Pi^10 + 137561852302875*Pi^12 - 180705224700*Pi^14 + 113565375*Pi^16 - 26565*Pi^18 + Pi^20) N[soln21, 50] 8.7552179522441867999995890586883880820029597565286863920136\ 338316`50*^-17 Extra precision is required for this and your case of n = 19 since the terms alternate sign. Bob Hanlon