MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

RE: Problems with Legendre expansion

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


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.


Fred Simons
Eindhoven University of Technology

  • Prev by Date: Re: Mathematica for High School Students
  • Next by Date: External programs, notebook interface
  • Previous by thread: Problems with Legendre expansion
  • Next by thread: Re: Problems with Legendre expansion