legendre_p(n,x) = legendre_p(-n-1,x)



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.

Dieter Kaiser