       Re: bug in Legendre polinomials

• To: mathgroup at smc.vnet.net
• Subject: [mg20357] Re: [mg20346] bug in Legendre polinomials
• From: BobHanlon at aol.com
• Date: Sun, 17 Oct 1999 03:01:45 -0400
• Sender: owner-wri-mathgroup at wolfram.com

```Peter,

I suspect that for the higher order cases that the expressions are too
complex for Simplify to find the right form to verify the equality.

Unprotect[Sum]; Clear[Sum]; Protect[Sum];

The Legendre polynomial, LegendreP[k, x] , is a special case of an associated
Legendre function of type 2, that is,

LegendreP[k, 0, 2, x]

LegendreP[k, x]

The generalization is needed as a transient form for Mathematica to relate
the expression with the hypergeometric function

(1 - x)^k * LegendreP[k, m, 2, (x + 1)/(1 - x)];

Using FunctionExpand to convert to a hypergeometric function then eliminating
the generalization by setting m to zero

(FunctionExpand[%] /. m -> 0) // Simplify

(1 - x)^k*Hypergeometric2F1[-k, 1 + k, 1, x/(-1 + x)]

Applying a quadratic transformation (A&S, 15.3.4) to the hypergeometric
function

(% /. Hypergeometric2F1[a_, b_, c_, z_] -> (1 - z)^-a *
Hypergeometric2F1[a, c - b, c, z/(z - 1)]) // Simplify

((1 - x)^(-1))^k*(1 - x)^k*Hypergeometric2F1[-k, -k, 1, x]

% // PowerExpand

Hypergeometric2F1[-k, -k, 1, x]

% == Sum[Binomial[k, i]^2  *  x^i, {i, 0, k}]

True

To force the use of the LegendreP expression for the sum:

Unprotect[Sum];
Sum[Binomial[m_, n_]^2  *  z_^n_, {n_, 0, m_}] :=
(1 - z)^m * LegendreP[m, (1 + z)/(1 - z)];
Protect[Sum];

Testing:

Sum[Binomial[k, i]^2  *  x^i, {i, 0, k}]

(1 - x)^k*LegendreP[k, (1 + x)/(1 - x)]

Bob Hanlon

In a message dated 10/16/1999 5:21:14 AM, pollner at physik.uni-marburg.de
writes:

>I have found a misterious bug (Version 4.0.1.0):
>
>I have checked the identity:
>Sum[Binomial[ktmp, i]^2 x^i, {i, 0, ktmp}] = (1 - x)^ktmp LegendreP[ktmp,
>(x + 1)/(1 - x)]
>
>using:
>
>Simplify[Sum[
>      Binomial[ktmp, i]^2 x^i, {i, 0, ktmp}] - (1 - x)^ktmp LegendreP[
>        ktmp, (x + 1)/(1 - x)]]
>
>which should be zero for arbitrary ktmp integers.
>Mathematica gives only for ktmp<36 the correct result
>for ktmp>=36 it gives a nonvanishing polinom.
>
>
>
>I am interested also to force Mathematica to give the result of the series
>
>Sum[Binomial[ktmp, i]^2 x^i, {i, 0, ktmp}]
>in terms of Legendre polinomials and not as terms of Hypergeometric
>functions.
>

```

• Prev by Date: Re: how to avoid numeric error
• Next by Date: Re: Questions on Plotting A Graph
• Previous by thread: bug in Legendre polinomials
• Next by thread: Re: bug in Legendre polinomials