LegendreP, LegendreQ - Maple Programming Help

Home : Support : Online Help : Mathematics : Conversions : Function : Legendre

LegendreP, LegendreQ

Legendre functions and associated Legendre functions of the first and second kinds

 Calling Sequence LegendreP(v, x) LegendreQ(v, x) LegendreP(v, u, x) LegendreQ(v, u, x)

Parameters

 v - algebraic expression (degree) u - algebraic expression (order) x - algebraic expression (argument)

Description

 • LegendreP(v, x) and LegendreP(v, u, x) are the Legendre and associated Legendre functions of the first kind. LegendreQ(v, x) and LegendreQ(v, u, x) are the Legendre and associated Legendre functions of the second kind. They satisfy the differential equation:

$\left(-{x}^{2}+1\right)y\mathrm{\text{'}\text{'}}-2xy\text{'}+\left(v\left(v+1\right)-\frac{{u}^{2}}{-{x}^{2}+1}\right)y=0$

 • The points 1, -1, and $\mathrm{\infty }$ are singularities of the equation (except in special cases) and ordinary branch points of the functions.
 • In standard references, the branch cuts are taken to be $\left(-\infty ,-1\right)$ and $\left(-1,1\right)$, and the values of the functions on the branch cut $\left(-1,1\right)$ are obtained by an averaging process (in order to obtain functions which are real valued on this interval).
 Rather than take this approach, Maple defines the default Legendre functions to be continuous from above onto the cuts, $\left(-\infty ,-1\right)$ and $\left(-1,1\right)$. However, alternative definitions of the Legendre functions are also available, which place the branch cuts as $\left(-\infty ,-1\right)$ and $\left(1,\infty \right)$; these functions are real valued on the interval $\left(-1,1\right)$. The selection between the two definitions for the Legendre functions is accomplished via assignment to the environment variable _EnvLegendreCut. If this environment variable is assigned the value $-1..1$, Maple provides the default behavior, which places a branch cut on the real line coincident with the interval $\left(-1,1\right)$. If this environment variable is assigned the value $1..\mathrm{\infty }$, Maple places branch cuts on the real line coincident with the intervals $\left(-\infty ,-1\right)$ and $\left(1,\infty \right)$.
 If _EnvLegendreCut is either not assigned or has the value $-1..1$, the LegendreP and LegendreQ functions have the following hypergeometric representation:
 > LegendreP(a,b,z) = convert( LegendreP(a,b,z), hypergeom);
 ${\mathrm{LegendreP}}{}\left({a}{,}{b}{,}{z}\right){=}\frac{{\left({z}{+}{1}\right)}^{\frac{{1}}{{2}}{}{b}}{}{\mathrm{hypergeom}}{}\left(\left[{-}{a}{,}{1}{+}{a}\right]{,}\left[{1}{-}{b}\right]{,}\frac{{1}}{{2}}{-}\frac{{1}}{{2}}{}{z}\right)}{{\left({z}{-}{1}\right)}^{\frac{{1}}{{2}}{}{b}}{}{\mathrm{Γ}}{}\left({1}{-}{b}\right)}$ (1)
 > LegendreQ(a,b,z) = convert( LegendreQ(a,b,z), hypergeom);
 ${\mathrm{LegendreQ}}{}\left({a}{,}{b}{,}{z}\right){=}\frac{{1}}{{2}}{}\frac{{{ⅇ}}^{{I}{}{b}{}{\mathrm{π}}}{}\sqrt{{\mathrm{π}}}{}{\left({z}{+}{1}\right)}^{\frac{{1}}{{2}}{}{b}}{}{\left({z}{-}{1}\right)}^{\frac{{1}}{{2}}{}{b}}{}{\mathrm{Γ}}{}\left({1}{+}{b}{+}{a}\right){}{\mathrm{hypergeom}}{}\left(\left[{1}{+}\frac{{1}}{{2}}{}{b}{+}\frac{{1}}{{2}}{}{a}{,}\frac{{1}}{{2}}{+}\frac{{1}}{{2}}{}{b}{+}\frac{{1}}{{2}}{}{a}\right]{,}\left[\frac{{3}}{{2}}{+}{a}\right]{,}\frac{{1}}{{{z}}^{{2}}}\right)}{{{z}}^{{1}{+}{b}{+}{a}}{}{\mathrm{Γ}}{}\left(\frac{{3}}{{2}}{+}{a}\right){}{{2}}^{{a}}}$ (2)
 The formula above for LegendreP is not valid when the second parameter, b, is a positive integer. In that case, the following formula is used:
 > LegendreP(a,b,z) = (z+1)^(b/2)*(z-1)^(b/2)*diff(LegendreP(a,z),[z\$b]);
 ${\mathrm{LegendreP}}{}\left({a}{,}{b}{,}{z}\right){=}{\left({z}{+}{1}\right)}^{\frac{{1}}{{2}}{}{b}}{}{\left({z}{-}{1}\right)}^{\frac{{1}}{{2}}{}{b}}{}{{2}}^{{b}}{}{\mathrm{pochhammer}}{}\left(\frac{{1}}{{2}}{,}{b}\right){}{\mathrm{GegenbauerC}}{}\left({a}{-}{b}{,}{b}{+}\frac{{1}}{{2}}{,}{z}\right)$ (3)
 For LegendreQ, the hypergeometric representation shown is not valid when the first parameter a+$\frac{3}{2}$ is a non-positive integer; in that case the following formula is applied recursively
 > LegendreQ(a,b,Z) = ((2*a+3)*Z*LegendreQ(a+1,b,Z) + (b-a-2)*LegendreQ(a+2,b,Z))/(a+1+b);
 ${\mathrm{LegendreQ}}{}\left({a}{,}{b}{,}{Z}\right){=}\frac{\left({2}{}{a}{+}{3}\right){}{Z}{}{\mathrm{LegendreQ}}{}\left({1}{+}{a}{,}{b}{,}{Z}\right){+}\left({-}{2}{+}{b}{-}{a}\right){}{\mathrm{LegendreQ}}{}\left({a}{+}{2}{,}{b}{,}{Z}\right)}{{1}{+}{b}{+}{a}}$ (4)
 Regardless of the value of b, in the hypergeometric representations above for LegendreP and LegendreQ, when _EnvLegendreCut has the value $1..\mathrm{\infty }$ the formulas used are obtained from those displayed by replacing the factor ${\left(z-1\right)}^{\frac{1}{2}b}$ by ${\left(1-z\right)}^{\frac{1}{2}b}$.
 The toroidal functions can be obtained by leaving _EnvLegendreCut unassigned (or assigning it the value $-1..1$) and composing with $\mathrm{cosh}\left(x\right)$: LegendreP(v, u, cosh(x)), etcetera.
 Similarly, the spherical harmonic functions can be obtained by setting $\mathrm{_EnvLegendreCut}≔1..\mathrm{\infty }$ and composing with $\mathrm{cos}\left(x\right)$: LegendreP(v, u, cos(x)), etcetera.
 Commands such as evalf and simplify have remember tables that do not take into consideration the setting of _EnvLegendreCut. After changing the value of _EnvLegendreCut, remember tables can be cleared by executing either the  restart command or the forget command (as in forget(evalf) or forget(simplify)).
 • The values returned by these functions when the argument is either 1 or -1 are the values that would be obtained by considering the order and degree parameters fixed and taking the appropriate limit in the argument.

Examples

 > $\mathrm{LegendreP}\left(1.3,2.54,1.7\right)$
 ${1.036634985}$ (5)
 > $\mathrm{LegendreP}\left(1.3,2.54,0.7\right)$
 ${-}{3.485914197}{+}{3.953993515}{}{I}$ (6)
 > $\mathrm{LegendreP}\left(1.3,2.54,0.7+0.0001I\right)$
 ${-}{3.487465642}{+}{3.952624688}{}{I}$ (7)
 > $\mathrm{_EnvLegendreCut}≔1..\mathrm{∞}:$
 > $\mathrm{forget}\left(\mathrm{evalf}\right):$
 > $\mathrm{LegendreP}\left(1.3,2.54,0.7\right)$
 ${5.271210724}$ (8)
 > $\mathrm{LegendreP}\left(1.3,2.54,0.7+0.0001I\right)$
 ${5.271209941}{+}{0.002068978010}{}{I}$ (9)
 > $\mathrm{_EnvLegendreCut}≔-1..1$
 ${\mathrm{_EnvLegendreCut}}{≔}{-}{1}{..}{1}$ (10)
 > $\mathrm{LegendreQ}\left(-2.4+1.7I,\mathrm{π}-\mathrm{γ}I,I\right)$
 ${-}{4720.643302}{+}{4608.249867}{}{I}$ (11)
 > $\mathrm{LegendreQ}\left(1.5,2,0.3+I\right)$
 ${-}{0.7992112483}{+}{0.2994630511}{}{I}$ (12)
 > $\mathrm{LegendreP}\left(\frac{1}{2},2,x\right)$
 ${\mathrm{LegendreP}}{}\left(\frac{{1}}{{2}}{,}{2}{,}{x}\right)$ (13)
 > $\frac{\partial }{\partial x}\mathrm{LegendreP}\left(v,u,\mathrm{cosh}\left(x\right)\right)$
 $\frac{\left(\left({v}{-}{u}{+}{1}\right){}{\mathrm{LegendreP}}{}\left({v}{+}{1}{,}{u}{,}{\mathrm{cosh}}{}\left({x}\right)\right){-}\left({v}{+}{1}\right){}{\mathrm{cosh}}{}\left({x}\right){}{\mathrm{LegendreP}}{}\left({v}{,}{u}{,}{\mathrm{cosh}}{}\left({x}\right)\right)\right){}{\mathrm{sinh}}{}\left({x}\right)}{{{\mathrm{cosh}}{}\left({x}\right)}^{{2}}{-}{1}}$ (14)
 > $\mathrm{_EnvLegendreCut}≔1..\mathrm{∞}:$
 > $\mathrm{simplify}\left(\mathrm{LegendreP}\left(5,x\right),'\mathrm{LegendreP}'\right)$
 $\frac{{63}}{{8}}{}{{x}}^{{5}}{-}\frac{{35}}{{4}}{}{{x}}^{{3}}{+}\frac{{15}}{{8}}{}{x}$ (15)
 > $\mathrm{simplify}\left(\mathrm{LegendreP}\left(5,3,x\right),'\mathrm{LegendreP}'\right)$
 ${-}{\left({1}{-}{x}\right)}^{{3}{/}{2}}{}{\left({x}{+}{1}\right)}^{{3}{/}{2}}{}\left({-}\frac{{105}}{{2}}{+}\frac{{945}}{{2}}{}{{x}}^{{2}}\right)$ (16)
 > $\mathrm{simplify}\left(\mathrm{LegendreQ}\left(5,x\right),'\mathrm{LegendreQ}'\right)$
 $\frac{{1}}{{2}}{}\left(\frac{{63}}{{8}}{}{{x}}^{{5}}{-}\frac{{35}}{{4}}{}{{x}}^{{3}}{+}\frac{{15}}{{8}}{}{x}\right){}\left({\mathrm{ln}}{}\left({x}{+}{1}\right){-}{\mathrm{ln}}{}\left({1}{-}{x}\right)\right){-}\frac{{8}}{{15}}{-}\frac{{63}}{{8}}{}{{x}}^{{4}}{+}\frac{{49}}{{8}}{}{{x}}^{{2}}$ (17)
 > $\mathrm{forget}\left(\mathrm{simplify}\right)$
 > $\mathrm{_EnvLegendreCut}≔-1..1$
 ${\mathrm{_EnvLegendreCut}}{≔}{-}{1}{..}{1}$ (18)
 > $\mathrm{simplify}\left(\mathrm{LegendreQ}\left(5,x\right),'\mathrm{LegendreQ}'\right)$
 $\frac{{1}}{{2}}{}\left(\frac{{63}}{{8}}{}{{x}}^{{5}}{-}\frac{{35}}{{4}}{}{{x}}^{{3}}{+}\frac{{15}}{{8}}{}{x}\right){}\left({\mathrm{ln}}{}\left({x}{+}{1}\right){-}{\mathrm{ln}}{}\left({x}{-}{1}\right)\right){-}\frac{{8}}{{15}}{-}\frac{{63}}{{8}}{}{{x}}^{{4}}{+}\frac{{49}}{{8}}{}{{x}}^{{2}}$ (19)
 > $\mathrm{simplify}\left(\mathrm{LegendreQ}\left(3,2,x\right),'\mathrm{LegendreQ}'\right)$
 ${15}{}\left({x}{-}{1}\right){}\left({x}{+}{1}\right){}{x}{}\left(\frac{{1}}{{2}}{}{\mathrm{ln}}{}\left({x}{+}{1}\right){-}\frac{{1}}{{2}}{}{\mathrm{ln}}{}\left({x}{-}{1}\right)\right){-}\frac{{15}{}{{x}}^{{4}}{-}{25}{}{{x}}^{{2}}{+}{8}}{\left({x}{-}{1}\right){}\left({x}{+}{1}\right)}$ (20)
 > $\mathrm{forget}\left(\mathrm{simplify}\right)$
 > $\mathrm{_EnvLegendreCut}≔1..\mathrm{∞}$
 ${\mathrm{_EnvLegendreCut}}{≔}{1}{..}{\mathrm{∞}}$ (21)
 > $\mathrm{simplify}\left(\mathrm{LegendreQ}\left(3,2,x\right),'\mathrm{LegendreQ}'\right)$
 ${15}{}\left({1}{-}{x}\right){}\left({x}{+}{1}\right){}{x}{}\left(\frac{{1}}{{2}}{}{\mathrm{ln}}{}\left({x}{+}{1}\right){-}\frac{{1}}{{2}}{}{\mathrm{ln}}{}\left({1}{-}{x}\right)\right){-}\frac{{15}{}{{x}}^{{4}}{-}{25}{}{{x}}^{{2}}{+}{8}}{\left({1}{-}{x}\right){}\left({x}{+}{1}\right)}$ (22)