custom Maple Legendre functions
DOCX · 107.4 KB
Open DOCX file
Dated 2.8.11, these are Phil's notes on replacing Maple's LegendreP and LegendreQ, which sometimes fail to evaluate, with his own hypergeometric-based definitions. They cover Mehler functions P_{-1/2+iτ}(cosh α) and toroidal functions, with Q_ν(cosh ξ) built from a one-term hypergeometric representation (36) since (42) and (46) hit Γ(μ) at μ=0. He tests the results against Maple, finds a case where LegendreQ fails, and plans to use the functions for donut potential sums.
AI-written summary; may contain errors.
Extracted text (machine-read; may contain errors)
Custom Maple Legendre functions.doc PhL 2.8.11
I keep having problems with evaluation of LegendreP and LegendreQ failing, but I think the hypergeom function does not have any such problems. So I will try to just write my own functions customized to what I am looking for.
1. Mehler functions.
In my doc "doing Mehler functions" Appendix A I claim that
P-1/2+iτ (chα) = e-(1/2)αeiατ F(1/2-iτ, 1/2; 1; 1 - e-2α)
Let's first try this in Maple this way]
Pmehler := (alpha,tau) -> exp(-alpha/2 + I*alpha*tau)*hypergeom([1/2-I*tau, 1/2],[1], 1 - exp(-2*alpha));
We always need to "do a test" to make sure things got entered correctly, so
and I am happy to have that tiny imaginary part which can be removed. Now we try a simple plot
and this is what I was wanting to see. But the LegendreP plots works fine, I am unable to replicate the problem I was having!
2. Toroidal functions.
OK, I will put this doc on hold for a while until the problem arises again. // That didn't take long. Here is a problem:
Maple refuses to compute this function. So let's try to make our own version. Ptoroidal(nu,alpha). We now need a Q rep that converges on the positive real axis above 1. Looking at the converge doc, there are two choices: (42) and (46). They both have two terms, fine.
arg for (42) is 1-1/z2 and with z = chξ this would be 1-sech2ξ = th2ξ
so that seems pretty good. So here is the entry
Qtor := (xi,nu) -> stop. It has Γ(μ) sitting there, no good since μ = 0.
How about (46)? Same problem. What does this mean?
How about (36) which should work at least down to 1.00001.
arg for (36) = 2/(1+z) = 2/(1+chξ) = 1/ ch2(ξ/2)
which is again fine. And (36) has only one term. So we try
f1 := 2^(nu);
f2 := (GAMMA(1+nu))^2;
f3 := (cosh(xi)+1)^(-nu-1)/GAMMA(2+2*nu);
f4 := hypergeom([1+nu,1+nu],[2+2*nu],1/(cosh(xi/2))^2;
Qtor :=(xi,nu) -> 2^(nu)*(GAMMA(1+nu))^2*(cosh(xi)+1)
OK, here now is a specific example of the problem:
My call to Qtor(-1/2,a) gives a result, but the same LegendreQ refuses to evaluate. It is not a cut problem because this also fails
Now having shown up a problem, let's show that we agree at some other value:
Here LegendreQ seems able to evaluate, and we get the same result.
So we seem pretty successful with (36) for Q. The "partner": to (36) is (18) but that has two terms.
Can we use the same P as used above, which was this
P-1/2+iτ (chα) = e-(1/2)αeiατ F(1/2-iτ, 1/2; 1; 1 - e-2α)
Pν(z) = zν F(-ν/2, 1/2-ν/2; 1; 1-1/z2)
So we could define
Ptor(nu,xi)
Pν(z) = zν F(-ν/2, 1/2-ν/2; 1; 1-1/z2)
P(ν,ξ) ≡ Pν(chξ) = (chξ)ν F(-ν/2, 1/2-ν/2; 1; th2ξ)
Qν(z) = 2ν [Γ(1+ν)]2 (z+1)-ν-1/Γ(2+2ν) * F(1+ν,1+ν,2+2ν, 2/(1+z)
Q(ν,ξ) = Qν(chξ) = 2ν [Γ(1+ν)]2 (chξ+1)-ν-1/Γ(2+2ν) * F(1+ν,1+ν,2+2ν, 2/(1+chξ)
I have now entered the above stuff into PandQ.mws and it looks very good
Then I can construct the kinds of sums we get in donut potential!