I would like to suggest to add the following identities to the code of
orthopoly
legendre_p(n,x) = legendre_p(-n-1,x) and
assoc_legendre_p(n,m,x) = assoc_legendre_p(-n-1,m,x)
This is the code I have added at the beginning of the routines
$legendre_p and $assoc_legendre_p:
(defun $legendre_p (n x)
(if (and (mnump n) (eq ($sign n) '$neg))
;; Use identity legendre_p(n,x)=legendre_p(-n-1,x) for a negative
n
(setq n (add (mul -1 n) -1)))
...
(defun $assoc_legendre_p (n m x)
(let ((f) (d) (dx 0))
(if (and (mnump n) (eq ($sign n) '$neg))
;; Use identity legendre_p(n,m,x)=legendre_p(-n-1,m,x) for a
negative n
(setq n (add (mul -1 n) -1)))
...
With these extensions we get:
(%i4) legendre_p(1,x);
(%o4) x
(%i5) legendre_p(-2,x);
(%o5) x
(%i6) assoc_legendre_p(1,m,x);
(%o6) assoc_legendre_p(1,m,x)
(%i7) assoc_legendre_p(-2,m,x);
(%o7) assoc_legendre_p(1,m,x)
The code of $hgfred uses the legendre functions a lot and it would be
important to get results for a negative degree of the legendre function
too.
Remark:
I have already implemented this identity in the code od $hgfred.
Therefore, we will get e.g.
(%i15) hgfred([-n,n+1],[1],x);
(%o15) legendre_p(n,1-2*x)
and not legendre_p(-n-1,1-2*x).
But this is not enough to make sure that we get the expected results
when we insert specific values in more general results which are in
terms of legendre functions.
Dieter Kaiser