About a hypergeometric functions (2F1).

Click For Summary
SUMMARY

The forum discussion centers on discrepancies in the results of the hypergeometric function (2F1) calculated using Mathematica and Matlab. Specifically, for the input 2F1(0.5, 1, 1.5, 5), Mathematica yields 0.21520 - 0.70248i, while Matlab provides 0.2152 + 0.7025i. The conversation highlights the multi-valued nature of the hypergeometric function and the importance of branch selection when evaluating complex functions. Users confirm that using the symbolic math toolbox in Matlab (version 2009b) aligns its output with Mathematica and Maple, emphasizing the need for clarity on branch choices in multi-valued functions.

PREREQUISITES
  • Understanding of hypergeometric functions, specifically the notation and properties of 2F1.
  • Familiarity with complex analysis, particularly the concept of multi-valued functions.
  • Experience with Mathematica and Matlab, especially the symbolic math toolbox.
  • Knowledge of series convergence and analytic continuation techniques.
NEXT STEPS
  • Research the implementation of hypergeometric functions in Mathematica and Matlab, focusing on version differences.
  • Study the principles of analytic continuation and how they apply to hypergeometric functions.
  • Explore the concept of branch cuts in complex analysis and their impact on function evaluation.
  • Learn about alternative software options for calculating hypergeometric functions, such as Maple and Python libraries.
USEFUL FOR

Mathematicians, physicists, and engineers who require precise calculations of hypergeometric functions, as well as software developers working with mathematical modeling in Matlab and Mathematica.

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.
 
Physics 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
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 6 ·
Replies
6
Views
2K
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 12 ·
Replies
12
Views
3K
  • · Replies 8 ·
Replies
8
Views
2K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K
  • · Replies 7 ·
Replies
7
Views
6K