# Why is LegendreQ[1/2,x] complex-valued for x>1?

Something is strange with $\sf LegendreQ$. Let $x>1$. I wonder why $\sf LegendreQ[\frac12,x]$ is complex-valued, and the following two codes do not give the same results:

LegendreQ[1/2,x]

Pi/2/(2*x)^(3/2)*Hypergeometric2F1[5/4,3/4,2,1/x^2]


(whose identity is given by Equation 8.820.2 of Gradshteyn & Ryzhik, 7th Ed.)

Thank you for your interest and time.

-
Please post code rather than LaTeX. – MarcoB Feb 15 at 6:28
Also, you should not use the bugs tag until the behavior is confirmed to be a bug by the community or by Wolfram support. – MarcoB Feb 15 at 6:34
The code is posted. Thanks for the proper tag. – scieng Feb 15 at 9:48
Welcome to Mathematica.SE! I suggest the following: 0) Browse the common pitfalls question 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the faq! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Dr. belisarius Feb 15 at 15:43

I don't have access to the book right now, but it probably states

LegendreQ[1/2, 0, 3, x] == Pi/2/(2 x)^(3/2) Hypergeometric2F1[5/4, 3/4, 2, 1/x^2]

-
I looked it up: the pre-factor works out to $\pi/(4 \sqrt{2})$ rather than $\pi/2$, but the rest holds as you wrote it. – MarcoB Feb 15 at 7:15
${\sf LegendreQ}[1/2,0,3,x]$ works. Thank you. By the way, the equality holds for $x>0$ according to $\it \text{www.wolframalpha.com}$. Somewhat confusing. – scieng Feb 15 at 11:57

As the documentation says, LegendreQ[n,m,a,z] gives Legendre functions of type a. The default is type 1. LegendreQ of types 1, 2, and 3 are defined in terms of LegendreP of these types, and have the same branch cut structure. Type 3 functions have a single branch cut from -Infinity to +1. So, as in the answer above, you need to specify type 3. And

Plot[{LegendreQ[1/2, 0, 3, x],
Pi/2/(2 x)^(3/2) Hypergeometric2F1[5/4, 3/4, 2, 1/x^2]},{x,1,5}]


looks fine.

-
Beyond $x>1$, the equality holds for $x>0$ according to $\it \text{www.wolframalpha.com}$. This confuses me. – scieng Feb 15 at 11:59