Am Samstag, den 30.01.2010, 22:01 +0100 schrieb Dieter Kaiser:
> The more I am working with the code of hgfred I realize that it seems to
> be necessary to implement the associated legendre function more
> complete.
>
> In general the associated legendre function P(n,m,z) can be defined for
> n an integer and m and z a complex value. Maxima knows the function for
> a positive integer n and m <= n.
>
> Two examples:
>
> (%i12) assoc_legendre_p(0,-1,x);
> (%o12) 0
>
> (%i14) assoc_legendre_p(1,1/2,x);
> (%o14) assoc_legendre_p(1,1/2,x)
>
> This is a definition of the associated legendre function which works for
> m a complex value too:
>
> leg(n,m,x):=('sum(pochhammer(-n,k)*pochhammer(n+1,k)*(1-x)^k
> /(2^k*k!*gamma(-m+k+1)),k,0,n))
> *(x+1)^(m/2)
> /(1-x)^(m/2)
>
> Some examples are:
>
> (%i15) leg(0,-1,x);
> (%o15) sqrt(1-x)/sqrt(x+1)
>
> (%i16) leg(1,1/2,x);
> (%o16) (1/sqrt(%pi)-2*(1-x)/sqrt(%pi))*(x+1)^(1/4)/(1-x)^(1/4)
>
> (%i17) leg(1,-1/2,x);
> (%o17) (2/sqrt(%pi)-4*(1-x)/(3*sqrt(%pi)))*(1-x)^(1/4)/(x+1)^(1/4)
>
> (%i18) leg(1,%i,x);
> (%o18) (1/gamma(1-%i)-(1-x)/gamma(2-%i))*(x+1)^(%i/2)/(1-x)^(%i/2)
>
> The point is, that we wish to return general results in terms of
> legendre functions from hgfred. But we get a lot of problems, because
> the legendre function does not simplify as expected for valid parameters
> to hgfred. The main source of errors is the simplification to zero when
> m>n. Furthermore, we do not get the expected simple results for m a
> rational number.
>
> Perhaps, we should extend the associated legendre function to handle an
> arbitrary order m too.
For the record one example:
This is what we actually have. The following is a special result for
a=1/2, b=1 and c=a+b+1/2:
(%i24) hgfred([1/2,1],[1/2+1+1/2],1-x^2);
(%o24) 2*(1-x)/(1-x^2)
We calculate the more general result:
(%i25) res:hgfred([a,b],[a+b+1/2],1-x^2);
(%o25) assoc_legendre_p(-b+a-1/2,-b-a+1/2,x)
*2^(b+a-1/2)*gamma(b+a+1/2)*(1-x^2)^((-b-a+1/2)/2)
When we insert the specific values from above we get the wrong result 0:
(%i26) res,a=1/2,b=1;
(%o26) 0
This is what we will get, when we extend the implementation of the
legendre function.
Again first the general result:
(%i12) res:hgfred([a,b],[a+b+1/2],1-x^2);
(%o12) 2^(b+a-1/2)*assoc_legendre_p(b-a-1/2,-b-a+1/2,x)*gamma(b+a+1/2)
*(1-x^2)^((-b-a+1/2)/2)
Now we get a result different from zero. This can be shown to be
equivalent to the correct result from above:
(%i13) res,a=1/2,b=1;
(%o13) 2*sqrt(1-x)/(sqrt(x+1)*sqrt(1-x^2))
To get this new result it is necessary to evaluate the associated
legendre function for n=0 and m=-1. An extended implementation will give
(%i14) assoc_legendre_p(0,-1,x);
(%o14) sqrt(1-x)/sqrt(x+1)
Dieter Kaiser