1
$\begingroup$

The orthogonality of Legendre polynomials:

$\int_{-1}^1 \mathrm{P}_l(x) \mathrm{P}_k(x) \mathrm{d} x=0, \quad k \neq l$

But

Integrate[LegendreP[l, x]*LegendreP[k, x], {x, -1, 1}, Assumptions -> Element[{l, k}, PositiveIntegers] && l != k]

(* Integrate[LegendreP[k, x] LegendreP[l, x], {x, -1, 1}, Assumptions -> (l | k) \[Element] Integers && l > 0 && k > 0 && l != k] *)

How should I write the code? Thanks!

$\endgroup$
2
  • $\begingroup$ Is 253675 helpful? $\endgroup$
    – Syed
    Commented Feb 8 at 14:52
  • $\begingroup$ I have seen this question and some related questions, which do not involve zero, so this is the content of my question. @Syed $\endgroup$
    – lotus2019
    Commented Feb 8 at 15:14

1 Answer 1

4
$\begingroup$
$Version

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

ClearAll["Global`*"]

int[k_Integer, k_Integer] := int[k, k] =
  Integrate[LegendreP[k, x]^2, {x, -1, 1}]

int[k_Integer, l_Integer] := int[k, l] =
  Integrate[LegendreP[k, x]*LegendreP[l, x], {x, -1, 1}]

Table[int[k, l], {k, -3, 3}, {l, -3, 3}] //
 TableForm[#, TableHeadings ->
    {Range[-3, 3], Range[-3, 3]}] &

enter image description here

For non-negative integers,

FindSequenceFunction[
  Table[{k, int[k, k]}, {k, 0, 3}], k] // Simplify

(* 2/(1 + 2 k) *)

Verifying outside of the range used in the FindSequenceFunction

And @@ Table[int[k, k] == 2/(2 k + 1), {k, 0, 50}]

(* True *)

Similarly for negative integers,

FindSequenceFunction[
  Table[{k, int[k, k]}, {k, -5, -1}], k] // Simplify

(* -(2/(1 + 2 k)) *)

And @@ Table[int[k, k] == -2/(2 k + 1), {k, -50, -1}]

(* True *)

Off the main diagonal,

FindSequenceFunction[
  Table[{k, int[k, -k - 1]}, {k, 0, 5}], k] // Simplify

(* 2/(1 + 2 k) *)

And @@ Table[int[k, -k - 1] == 2/(2 k + 1), {k, 0, 50}]

(* True *)

and,

FindSequenceFunction[
  Table[{k, int[k, -k - 1]}, {k, -5, -1}], k] // Simplify

(* -(2/(1 + 2 k)) *)

And @@ Table[int[k, -k - 1] == -2/(2 k + 1), {k, -50, -1}]

(* True *)
$\endgroup$
1
  • $\begingroup$ Thank you for your response. It seems that without using mathematical methods and only utilizing MMA code, it's impossible to obtain results directly by symbolically integrating the parameterized Legendre functions. Instead, the conclusion can only be reached through enumeration by adopting an assignment-based approach. $\endgroup$
    – lotus2019
    Commented Feb 9 at 3:57

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.