About a hypergeometric functions (2F1).

AI Thread Summary
The discussion revolves around discrepancies in the results of the hypergeometric function (2F1) calculated using Mathematica and Matlab. Users report different outputs for the same inputs, particularly noting the sign of the imaginary part. The conversation highlights that the hypergeometric function is multivalued, leading to multiple correct values depending on the chosen branch. It is also noted that while series representations converge only within a certain radius, analytic continuations can be used outside this range. The consensus leans towards Mathematica's results being more reliable, but the differences in Matlab's outputs prompt questions about the methods used for calculations.
xylai
Messages
58
Reaction score
0
Today, I use two softwares to calculate the value of a hypergeometric functions (2F1). One is Mathematica and another is Matlab. But they give me different results.
For examples:
(1) 2F1(0.5, 1., 1.5, 5) (Pay an attention to the sign of the image part.)

Mathematica's result: 0.21520 - 0.70248 i
Matlab's result: 0.2152 + 0.7025 i


(2) 2F1(2,3,4,5)

Mathematica's result: 0.156542+ 0.150796 i
Matlab's result: 0.1565 + 0.1508 i

Now, I am confused.
 
Mathematics news on Phys.org
First you need to answer a question. When you evaluate a power series outside its radius of convergence, what is it you want to do? Once you answer that, you can investigate what the two softwares have chosen to do.

Maple says
<br /> {{}_2{\rm F}_1(1/2,1;\,3/2;\,z)}={\frac {{\rm arctanh} \left( \sqrt {z}<br /> \right) }{\sqrt {z}}}<br />
The function tanh(z) has values between -1 and 1 for real z, so you need complex numbers to evaluate arctanh at z=\sqrt{5}. And arctanh is multi-valued as a complex function, so you need some convention of whch branch to choose. Maple agrees with Mathematica on this.
But Matlab's value is also "a value" of this multi-valued function.
 
I'm wondering how you are doing this in matlab. Are you using the symbolic math toolbox or some third-party code, or am I just not aware of another option?

I am running MATLAB 2009b, and with the symbolic math toolbox I get:

>> z=hypergeom([.5, 1], 3/2, 5)

z =

0.215204470482002 - 0.702481473104073iwhich agrees with mathematica and maple.

Of course, g_edgar is right, that the function is multivalued and thus without specifying a branch there are multiple values that are correct. The fact that the series representation only converges for arguments with magnitude less than one doesn't bother me - there are integral representations that provide an analytic continuation outside the unit circle, with the caveat that you have to chose a branch and cut ...

jason

EDIT: I just realized that it is only the series about 0 that only converges for |z|<1. series about other points can also provide analytic continuation outside the unit circle.
 
Last edited:
jasonRF said:
I'm wondering how you are doing this in matlab. Are you using the symbolic math toolbox or some third-party code, or am I just not aware of another option?

I am running MATLAB 2009b, and with the symbolic math toolbox I get:

>> z=hypergeom([.5, 1], 3/2, 5)

z =

0.215204470482002 - 0.702481473104073i


which agrees with mathematica and maple.

Of course, g_edgar is right, that the function is multivalued and thus without specifying a branch there are multiple values that are correct. The fact that the series representation only converges for arguments with magnitude less than one doesn't bother me - there are integral representations that provide an analytic continuation outside the unit circle, with the caveat that you have to chose a branch and cut ...

jason

EDIT: I just realized that it is only the series about 0 that only converges for |z|<1. series about other points can also provide analytic continuation outside the unit circle.

Yes, you're right that hypergeometric function is multivalued. I think the result of Mathematica is more serious.


Just now, I ran MATLAB R2007a:
>> z=hypergeom([.5, 1], 3/2, 5)

z =

0.2152 + 0.7025i
 
Seemingly by some mathematical coincidence, a hexagon of sides 2,2,7,7, 11, and 11 can be inscribed in a circle of radius 7. The other day I saw a math problem on line, which they said came from a Polish Olympiad, where you compute the length x of the 3rd side which is the same as the radius, so that the sides of length 2,x, and 11 are inscribed on the arc of a semi-circle. The law of cosines applied twice gives the answer for x of exactly 7, but the arithmetic is so complex that the...
Is it possible to arrange six pencils such that each one touches the other five? If so, how? This is an adaption of a Martin Gardner puzzle only I changed it from cigarettes to pencils and left out the clues because PF folks don’t need clues. From the book “My Best Mathematical and Logic Puzzles”. Dover, 1994.

Similar threads

Back
Top