2
$\begingroup$

I am trying to integrate a product of 2 Legendre polynomials as follows:

Integrate[LegendreP[1, x] LegendreP[2l+1, x], {x, -1, 1}]

I get the result:

Sin[2 l \[Pi]]/(l (3 + 2 l) \[Pi])

which is always 0 for integer values of l, but shouldn't the result be 0 for $2l+1\neq1$ and 2/3 for $2l+1=1$, since the LegendreP are orthogonal?

$\endgroup$
1
  • 1
    $\begingroup$ To evaluate definite integrals depending on a parameter at a value for the parameter, it is more reliable to use Limit as some answers below show. This is sometimes described in terms of "generic" results. Many times it corresponds to the limitations of our notation. For instance, in results that have Sin[] of the parameter (as in your case), replacing Sin[] by Sinc[] via Sin -> (# Sinc[#] &) often gives a result valid for all values of the parameter. Note Limit[ans, l -> value] does not take a lot of time when ans is continuous, though it is slower than direct substitution. $\endgroup$
    – Michael E2
    Commented Oct 8, 2020 at 15:22

4 Answers 4

1
$\begingroup$

Look at

Table[Sin[2 l \[Pi]]/(l (3 + 2 l) \[Pi]), {l, -2, 2}]

and then try

Limit[Sin[2 l \[Pi]]/(l (3 + 2 l) \[Pi]), l -> 0]
$\endgroup$
1
$\begingroup$

Add Assumptions by hand or calculate the Limit

Integrate[LegendreP[1, x] LegendreP[2 l + 1, x], {x, -1, 1}, 
 Assumptions -> l == 0]
Limit[Integrate[LegendreP[1, x] LegendreP[2 l + 1, x], {x, -1, 1}], 
 l -> 0]
Integrate[LegendreP[1, x] LegendreP[2 l + 1, x], {x, -1, 1}, 
 Assumptions -> 3 + 2 l == 0]
Limit[Integrate[LegendreP[1, x] LegendreP[2 l + 1, x], {x, -1, 1}], 
 l -> -(3/2)]
$\endgroup$
1
$\begingroup$
Clear["Global`*"]

Use Piecewise to handle the special case.

f[l_, x_] = 
 Piecewise[{{Integrate[LegendreP[1, x] LegendreP[2 l + 1, x], {x, -1, 1}], 
    ll != 0}, {Integrate[LegendreP[1, x] LegendreP[1, x], {x, -1, 1}], 
    l == 0}}]

enter image description here

Simplify[f[l, x], Element[l, Integers] && l != 0]

(* 0 *)
$\endgroup$
0
$\begingroup$

Note that sometimes a general result is returned. Think of:

Integrate[x^p,x]

returns:

x^(1+p)/(1+p)

However,

Integrate[x^-1, x]

gives:

Log[x]

But that is not represented by the general result…

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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