With the same purpose as this question, I wish to evaluate an integral that contains the squared Legendre Polynomials.


I tried evaluating with no success: Assuming[{$n$$\in$Integers,n$\geq$0},$\int_{-1}^{1}$LegendreP[n,x]$^2$dx]

Assuming[{Element[n, Integers], n >= 0}, 
 Integrate[LegendreP[n, x]^2, {x, -1, 1}]]

It seems odd that Mathematica wouldn't natively consider doing this, because Wolfram has specified the relationship on mathworld.wolfram.com - See Eqn(28).

I am not familiar with the backend processes of Mathematica, however I would expect a check to be performed when integrating with Legendre Polynomials.

Why is this not the case, and is there any alternative for an algebraic solution?

Edit: Example

An example of where this may be used is in solving an ODE that is a Sturm-Liouville System, and is very close in relation to the Legendre DE:

$([1-x^2]u')' + \mu \rho(x) u = f(x)$

Both when $\mu=\lambda_n$ and $\mu\neq\lambda_n$ for some n, the solution for u(x) will involve series coefficients $\gamma_n$: $\gamma_n = \frac{\int_{-1}^{1}f(x) u_n(x)dx}{\int_{-1}^{1}\rho(x)u_n(x)^2dx}$

Here for the Legendre SL system we know there are eigenfunctions $u_n = $ LegendreP[n,x]. The evaluation I considered will be used in the denominator when calculating such series coefficients.

  • 2
    $\begingroup$ Mathematica cannot do every integral that's found in integral tables (no CAS can), and there isn't really a practical problem in the question. You already have the solution. The question reads more like a rant than a question. Can you edit it to ask about an actual practical problem? $\endgroup$
    – Szabolcs
    Sep 4 '17 at 14:32
  • $\begingroup$ I won't vote to close, but I think this is not a suitable question for this site. It is clear enough that you did not make a mistake. Mathematica just doesn't know this integral. One could speculate about why it's not really useful to teach it about such integrals, but that would just be speculation. We also don't know how Integrate works internally (though I assume that teaching it about this particular case wouldn't do more good than being able to compute this one particular case). $\endgroup$
    – Szabolcs
    Sep 4 '17 at 14:44
  • $\begingroup$ The reasonable thing for you to do would be to contact Wolfram Support and ask for this feature to be added rather than talk about it on M.SE. M.SE is not affiliated with Wolfram, so if you want it added, it's not useful to ask here (it's also off topic). $\endgroup$
    – Szabolcs
    Sep 4 '17 at 14:45
  • $\begingroup$ A potential example of the usefulness of such a problem would be in finding eigenfunction expansions in Legendre polynomials, where depending on your ODE you will be required to evaluate series coefficients including a LegendreP[n,x]^2 term. An example would be $(1-x^2)u'' - 2xu' + \lambda u = f(x)$. $\endgroup$
    – Mr G
    Sep 4 '17 at 14:59
  • $\begingroup$ @Szabolcs Thankyou for your feedback, should I delete the question instead? You're right that this will serve little purpose in suggesting implementation, however perhaps it's useful for people stumbling into the same related special-function use as a "there-is-no-way-good-way-around-it"? $\endgroup$
    – Mr G
    Sep 4 '17 at 15:00

Generate a sequence using Table then use FindSequenceFunction to find the general form

f[n_] = FindSequenceFunction[
  Table[Integrate[LegendreP[n, x]^2, {x, -1, 1}], {n, 10}], n]

(*  2/(1 + 2 n)  *)

Checking outside the original range

f[n] == Integrate[
   LegendreP[n, x]^2, {x, -1, 1}] /. {{n -> 20}, {n -> 50}}

(*  {True, True}  *)
  • $\begingroup$ The FindSequenceFunction seems very useful for this purpose! Good solution. $\endgroup$
    – Mr G
    Sep 5 '17 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.