3
$\begingroup$

The integral of the product of Legendre polynomials and power functions:

$I=\int_{-1}^1 x^n \mathrm{P}_l(x) \mathrm{d} x$

The calculation result from the textbook is:

$$ \begin{aligned} I & =0 \end{aligned} (n<l)$$

$$ \begin{aligned} I & =\frac{n !}{(n+l+1) ! !(n-l) ! !}\left[1+(-1)^{n-l}\right] \end{aligned} (n>=l)$$

Firstly, direct integration is unsuccessful:

Clear["Global`*"];

Integrate[x^n*LegendreP[l, x], {x, -1, 1},  Assumptions -> Element[{l, n}, PositiveIntegers]]

(* Failed *)

The result couldn't be obtained using FindSequenceFunction. Is it because the pattern is too complex or there are errors in the code?

Clear["Global`*"];

int[n_Integer, l_Integer] := int[n, l] = Integrate[x^n*LegendreP[l, x], {x, -1, 1}]

Table[int[n, l], {n, 1, 7}, {l, 1, 8}] // TableForm[#, TableHeadings -> {"n" Range[1, 7], "l" Range[1, 8]}] &

Then,

Table[{l, FindSequenceFunction[Table[{n, int[n, l]}, {n, l, l + 20}], n]}, {l, 1, 10}]

(* {a long table} *)

FindSequenceFunction[%, l]

(* Failed *)

Ref:

https://mathematica.stackexchange.com/a/297745/69835

Is there a multidimensional FindSequenceFunction for multi-parameter pattern discovery?

$\endgroup$

2 Answers 2

5
$\begingroup$
$Version

(* "14.0.0 for Mac OS X ARM (64-bit) (December 13, 2023)" *)

Clear["Global`*"]

int[n_Integer?Positive, l_Integer?Positive] := int[n, l] =
  Integrate[x^n*LegendreP[l, x], {x, -1, 1}]

Table[int[n, l], {n, 1, 7}, {l, 1, 8}] //
 TableForm[#, TableHeadings -> {
     StringForm["n=``", #] & /@ Range[7],
     StringForm["l=``", #] & /@ Range[8]}] &

enter image description here

(tab1 = Table[{l, 
      FindSequenceFunction[Table[{n, int[n, l]}, {n, l, l + 20}], n]}, {l, 1, 
      20}] // FullSimplify)[[1 ;; 4]]

enter image description here

Convert tab1 to Piecewise expressions

(tab2 = Simplify[{#[[1]], Piecewise[{
         {Simplify[#[[2]], Mod[n, 2] == 0], Mod[n, 2] == 0},
         {Simplify[#[[2]], Mod[n, 2] == 1], Mod[n, 2] == 1}}]} & /@
     tab1])[[1 ;; 4]]

enter image description here

Handle the even and odd values of l separately.

int2[n_Integer?Positive, l_Integer?Positive] = 
 Evaluate@Piecewise[{{Assuming[Mod[n, 2] == 1 && Mod[l, 2] == 1, 
      FindSequenceFunction[tab2[[1 ;; ;; 2]] // FullSimplify, l] //
       FullSimplify], Mod[n, 2] == 1 && Mod[l, 2] == 1},
    {Assuming[Mod[n, 2] == 0 && Mod[l, 2] == 0, 
      FindSequenceFunction[tab2[[2 ;; ;; 2]] // FullSimplify, l] //
       FullSimplify], Mod[n, 2] == 0 && Mod[l, 2] == 0}}]

enter image description here

Verifying that int2 is equivalent to int

And @@ (Flatten@Table[int[n, l] == int2[n, l], {n, 1, 30}, {l, 1, 30}])

(* True *)
$\endgroup$
2
$\begingroup$

Not using FindSequenceFunction:

$$P_l(x)=\sum _{j=0}^{\infty } \sum _{k=0}^{\infty } \frac{2^{-j-k} (-x)^j (-l)_{j+k} (1+l)_{j+k}}{j! k! (j+k)!}$$

$Version
(*"14.0.0 for Microsoft Windows (64-bit) (December 13, 2023)"*)

Int = Integrate[(2^(-j - k) (-x)^j Pochhammer[-l, j + k] Pochhammer[1 + l, j + k])/(j! k! (j + k)!)*x^n, {x, -1, 1}][[1]]
S = Sum[Int, {j, 0, Infinity}, {k, 0, Infinity}]
(* long answer*)
F = FullSimplify[S, Assumptions -> {n \[Element] Integers && l \[Element] Integers}]// FunctionExpand

(* (2 (-1 + (-1)^n) Sqrt[\[Pi]]
 HypergeometricPFQ[{1/2 - l/2, 1 + l/2, 1 + n/2}, {3/2, 2 + n/2}, 
1])/((2 + n) Gamma[
1/2 + l/2] Gamma[-(l/2)]) + ((1 + (-1)^n) Sqrt[\[Pi]]
HypergeometricPFQ[{1/2 + l/2, -(l/2), 1/2 + n/2}, {1/2, 3/2 + n/2},
1])/((1 + n) Gamma[1/2 - l/2] Gamma[1 + l/2]) *)

Table[{Integrate[LegendreP[l, x] x^n, {x, -1, 1}], F,(n!)/(Factorial2[n + l + 1]*Factorial2[n - l])*(1 + (-1)^(n - l))}, {n, 1, 10}, {l,
1, 10}] // MatrixForm (*OK*)

$$\int_{-1}^1 P_l(x) x^n \, dx=\frac{2 \left(-1+(-1)^n\right) \sqrt{\pi } \, _3F_2\left(\frac{1}{2}-\frac{l}{2},1+\frac{l}{2},1+\frac{n}{2};\frac{3}{2},2+\frac{n}{2};1\right)}{(2+n) \Gamma \left(\frac{1}{2}+\frac{l}{2}\right) \Gamma \left(-\frac{l}{2}\right)}+\frac{\left(1+(-1)^n\right) \sqrt{\pi } \, _3F_2\left(\frac{1}{2}+\frac{l}{2},-\frac{l}{2},\frac{1}{2}+\frac{n}{2};\frac{1}{2},\frac{3}{2}+\frac{n}{2};1\right)}{(1+n) \Gamma \left(\frac{1}{2}-\frac{l}{2}\right) \Gamma \left(1+\frac{l}{2}\right)}$$

$\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.