# About a hypergeometric functions (2F1).

• xylai

#### xylai

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.

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
$${{}_2{\rm F}_1(1/2,1;\,3/2;\,z)}={\frac {{\rm arctanh} \left( \sqrt {z} \right) }{\sqrt {z}}}$$
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.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.

Last edited:
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