File Exchange

image thumbnail

Gauss hypergeometric function

version (20.9 KB) by Siyi Deng
Numerically compute real valued Gauss hypergeometric function, using Scipy c-source files


Updated 11 Oct 2013

View License

Note: run make_hyp2f1.m to compile mex files first!

Accurately compute real valued Gauss hypergeometric funciton 2F1(a,b;c;d) using c source files from SciPy.

Much faster than the HYPERGEOM function from symbolic math toolbox. In some cases it is more accurate than HYPERGEOM as well.

Equivalent of scipy.special.hyp2f1()

Tested on a 64-bit windows 7 and 64-bit CentOS 6.3

Cite As

Siyi Deng (2020). Gauss hypergeometric function (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (7)

Asadullah Bhuiyan

I am getting an error 'Warning: Error threshold not reached.' for values of b>1/2

Xiaotian Zhu

Very fast and accurate! Just wondering will it be possible to control the accuracy threshold (absolute tolerance) so that we can balance the computation precision and speed according the actual need, and maybe provide somewhat control on the numerical stability?

Siyi Deng

Liuxing: but it is stated in the introduction that this is "real valued Gauss hypergeometric function".


Not support in complex variable.

Jason Nicholson

Well done. Thank you for the code. I am using it to build Associated Legendre Functions of fractional order. It is very quick. This is very help to my regression work. It opens the door for me to use Associated Legendre functions of fractional order as basis. This is extremely powerful.

Siyi Deng

Junhong YE: I appreciate your feedback, but In the introduction it is stated that this function is for numerical purposes. So isn't it a bit unfair to accuse this function for symbolic computation errors.

Junhong YE

For numerical purpose, it works really fast. However, when symbolic computation is invoved, error happens. Though, it's a good work.

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux

Inspired: HyperGeometric2F1(a, b, z)