I would like to integrate the following function with Legendre polynomial and Gamma function. I am open to suggestions.

(* assumptions = {s > 0, α > 0} *)

Φ[s_, x_, α_] := (-1)^s Sqrt[(s α)/Gamma[1 + 2*s]] 
                 LegendreP[s, s, Tanh[α x]]

a1 =  Integrate[x Φ[s, x, α]^2, {x, -∞, ∞}]
  • 4
    $\begingroup$ Please provide a Mathematica code instead of a LaTeX one. $\endgroup$
    – Öskå
    Commented Sep 2, 2013 at 14:45
  • $\begingroup$ Integrate::idiv: "Integral of x\ LegendreP[s,s,Tanh[x\[Alpha]]]^2 does not converge on {-[Infinity],[Infinity]}." You probably have an error in the function definition or in the boundary conditions. $\endgroup$
    – Sektor
    Commented Sep 2, 2013 at 15:49
  • $\begingroup$ Table[Integrate[x \[Phi][s, x, a]^2, {x, -\[Infinity], \[Infinity]}, Assumptions -> a > 0], {s, 20}] yields {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}. $\endgroup$
    – Artes
    Commented Sep 2, 2013 at 16:32
  • $\begingroup$ Integrate[Evaluate[(-1)^s Sqrt[(s a)/Gamma[1 + 2*s]] LegendreP[s, s, Tanh[a x]] /. {a -> 2, s -> 5}], {x, -\[Infinity], \[Infinity]}]..in your method call you are calling function you are passing symbols, Shall you not pass values ? $\endgroup$ Commented Sep 2, 2013 at 19:08

2 Answers 2


If you evaluate the square of the function Φ[s, x, α] you get the following:

 FullSimplify[( Sqrt[(s α)/Gamma[1 + 2*s]]
   LegendreP[s, s, Tanh[α x]])^2, {α > 0, s > 0}]

(*   (s α LegendreP[s, s, Tanh[x α]]^2)/Gamma[1 + 2 s] *)

Thus, you only need to think of how to integrate the LegendreP[s, s, Tanh[α x]])^2. When looking at this function it becomes clear that the cases with integer and real values of s are different. Namely, if s is integer, the Legendre polynomials you need are even. Check this:

    Plot[{LegendreP[1, 1, Tanh[x ]], LegendreP[2, 2, Tanh[x ]], 
  LegendreP[3, 3, Tanh[x ]]}, {x, -2, 2}, PlotRange -> All, 
 PlotStyle -> {Red, Blue, Green}]

enter image description here
Here I plotted the LegendreP[3, 3, Tanh[x ]] function itself, not its square, just to make all three lines visible together. It is clear in this case that LegendreP[s, s, Tanh[α x]])^2 is also even, while your integrand, x*LegendreP[s, s, Tanh[x α]]^2 is odd. The integral is, therefore, zero.

The different story would be with the real s values. Check this:

    Plot[{LegendreP[0.1, 0.1, Tanh[x ]]^2, 
  LegendreP[0.4, 0.4, 2, Tanh[x ]]^2, 
  LegendreP[0.92, 0.92, Tanh[x ]]^2}, {x, -4, 4}, PlotRange -> All, 
 PlotStyle -> {Red, Blue, Green}]

enter image description here It is quite clearly visible that the curves are neither even, not odd. Have a look especially at the green one, the most manifested. Check also this:

 Plot[{LegendreP[s, s, Tanh[x ]]^2, 
   x*LegendreP[s, s, Tanh[x ]]^2}, {x, -4, 4}, 
  PlotStyle -> {Red, Blue}], {{s, 1.026}, 0, 2}]

enter image description here Here, as you see, the red line shows the behavior of the Legendre squared, while the blue one is that multiplied by x.
In addition they seem to increase with x. Indeed,

 Limit[LegendreP[0.92, 0.92, Tanh[x ]]^2, x -> Infinity]

(*  ∞  *)

This looks correct, but I would recommend you to check this last statement at some textbook on Legendre polynomials (like, e.g. Abramovitz and Stigun http://people.math.sfu.ca/~cbm/aands/).

The outcome is that for such s values the integral is infinity.

  • $\begingroup$ the values of s is a positive integer. $\endgroup$
    – user0322
    Commented Sep 3, 2013 at 10:25
  • $\begingroup$ @Herman Then the result is zero. $\endgroup$ Commented Sep 4, 2013 at 7:06
  • $\begingroup$ @ Alexei would it be possible to get a closed form for the following integral?a3 = Integrate[-[ImaginaryI] x [Phi][s, x, [Alpha]] [Phi]1[s, x, [Alpha]], {x, -[Infinity], [Infinity]}, Assumptions -> [Alpha] > 0, s > 0] $\endgroup$
    – user0322
    Commented Sep 5, 2013 at 11:35
  • $\begingroup$ @Herman Something is missing in the expression you have written here. I cannot understand, what function do you need to integrate. $\endgroup$ Commented Sep 6, 2013 at 11:41

Heman, I did not get what function did you ask about in your comment.Probably it is due to a non-Mathematica code. However, it seems that it is either a square of your Phi function (described in your original question), of some combinations of several such functions.

I think this integral can hardly be expected to be calculated analytically because of its unusual argument. Nevertheless, before giving up I would advice you to check the tables of integral of Prudnikov, Brychkov, Marichev. At least two volumes of their collection are on the integration of special functions. May be some variables change may be of use, such that you make some more convenient thing under the Legendre polynomial, but with the penalty of some weight appearing in front of it. Anyway, if you succeed, it will be the place where science transforms into art.

The question is what do you need it for? Will an approximate function also do?

If yes, I can offer a simple workaround. I do it within the example of the square of the Legendre function, and you may proceed by analogy with the function you need.

This determines the integral numerically in the form of a list {s, Log[Int]}. I calculate the Log of the integral, since it otherwise grows too rapidly:

lst = Table[{s, 
      LegendreP[s, s, 
       Tanh[x]]^2, {x, -∞, ∞}]]}, {s, 1, 10}];

Note that the parameter alfa plays, evidently, no role. You can verify this by the replacement x->afa*x, which I did.

rnd[expr_] := expr /. x_Real :> Round[x, 0.001];

The following fits the numerical table by a simple function of s: f(s)=a+b*s^c

 ft = Fit[lst, {1, s^c}, s];
   ListPlot[lst, Frame -> True, 
    FrameLabel -> {Style["s (integer only values)", 16], 
      Style["Log{\!\(\*SubsuperscriptBox[\(∫\), \(-\
∞\), \(∞\)]\)\!\(\*SubsuperscriptBox[\(P\), \
\(s\), \(s\)]\)[tanh(x)]\[DifferentialD]x}", 16]}],
   Plot[ft, {s, 1, 10}, PlotStyle -> Red, Frame -> True]
   }, Epilog -> Inset[Framed[Column[{
       PointLegend[{Blue}, {Style["   Numeric values of integral", 
       LineLegend[{Red}, {Row[{Style["Fit with ", 12], 
           Style["f(c)≈", 12, Italic], 
           Style[rnd[ft], 12, Italic]}]}]
       }], RoundingRadius -> 5, Background -> LightYellow], 
    Scaled[{0.35, 0.8}]]],
 {{c, 1.5, Dynamic@Row[{"c= ", c}]}, 1, 3}]

That's how it should look like: enter image description here, Play a bit with the slider to choose the best value. Have fun.

  • $\begingroup$ Alexei, I reopened this question -- why don't you move your question edit to an answer now? By the way, in the future if you have something useful to add to a closed question please comment or, if necessary, flag the post and explain. $\endgroup$
    – Mr.Wizard
    Commented Sep 11, 2013 at 0:50

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.