# LegendreQ[2,z] formula on functions.wolfram.com unequals result from Mathematica

The formula for LegendreQ[2,z] on this functions.wolfram.com page gives:

Expand[(1/2) (Log[1 + z] - Log[1 - z]) LegendreP[2, z] + Sum[((4 - 4 k - 1)/((2 k + 1) (2 - k))) LegendreP[2 - 2 k - 1, z], {k, 0, Floor[(2 - 1)/2]}]]


which can be evaluated to:

(3 z)/2 + 1/4 Log[1 - z] - 3/4 z^2 Log[1 - z] - 1/4 Log[1 + z] +
3/4 z^2 Log[1 + z]


whereas Expand[LegendreQ[2,z]] directly evaluated gives:

-((3 z)/2) + 1/4 Log[1 - z] - 3/4 z^2 Log[1 - z] - 1/4 Log[1 + z] +
3/4 z^2 Log[1 + z]


I assumed that both results are the same, but Mathematica gives a different sign for the ((3 z)/2) term?

That's an error on the Wolfram Functions page. (Please report it to comments(AT)functions(DOT)wolfram(DOT)com.)

The correct formula is

$$Q_n(z)=\frac12\left(\log(1+z)-\log(1-z)\right)P_n(z)\color{red}{-}\sum_{k=0}^{\left\lfloor\frac{n-1}2\right\rfloor}\frac{2n-4k-1}{(2k+1)(n-k)}P_{n-2k-1}(z)$$

or, in Mathematica format,

LegendreQ[n, z] == (1/2) (Log[1 + z] - Log[1 - z]) LegendreP[n, z] -
Sum[((2 n - 4 k - 1)/((2 k + 1) (n - k))) LegendreP[n - 2 k - 1, z],
{k, 0, Floor[(n - 1)/2]}]

• I assume, had the error been in M's result, there wouldn't be close votes? At the same time, this answer reaffirming M's correct behavior seems necessary. Now I can't make up my mind. Nov 3, 2017 at 14:02
• Not really sure. I certainly didn't vote to close since my vote is instantly fatal. Nevertheless, I think this is a good example on how to use Mathematica to verify any formula you've found on the Internet. Nov 3, 2017 at 14:16