File Exchange

image thumbnail

Generalized Hypergeometric Function

version (52 KB) by Ben Barrowes
Calculates the Generalized Hypergeometric Function at the desired accuracy.


Updated 06 Jan 2005

View License

A numerical evaluator for the generalized hypergeometric function for complex arguments with large magnitudes using a direct summation of the Gauss series.

pFq isdefined by (borrowed from Maple):
pFq = sum(z^k / k! * product(pochhammer(n[i], k), i=1..p) / product(pochhammer(d[j], k), j=1..q), k=0..infinity )

The desired accuracy (number of digits) can be specified as a parameter.

This function is a translation from the original fortran77 source code written by W. F. Perger from the Michigan Technological University.

Cite As

Ben Barrowes (2021). Generalized Hypergeometric Function (, MATLAB Central File Exchange. Retrieved .

Comments and Ratings (10)


Don Eliason

It would be nice if the z portion of the input could be a vector. Presently (genHyper_1.2), z must be a scalar, at least for the native Matlab version.


how to download it please?

Xiaogang Zhu

very good!

James B

In general, this function works just fine. However, a word of warning. If you plan on executing the function more than 8,192 times in any given MATLAB session, you will need to either a) run MATLAB -nojvm from Cygwin, or comment out ALL of the write statements in the Fortran code. Evidently all of these write statements fill up some kind of buffer in the desktop implementation that is bypassed when you run MATLAB from Cygwin. This behavior is present in 2007a Student Version and 2008a full version. I compiled the code using MINGW and the GNUMEX kit.

Other issues include the STOP statements in the code that will cause MATLAB to exit erroneously. I had to replace all of the STOP statements with the appropriate MATLAB MEX error statement.

tassaddaq hussain

it is fair software and fullfill my requirement to a great extent

Huynh Hieu

It is good. But do you do about Meijer G function? Could you help me? Thank

Jia Chen

Very good code!

Matt Nunes

Wang Xudong

Why the program does not operate with Matlab 6.5 ? It occurs some errors as follow--- ??? Error: File: D:\MATLAB6p5p1\stbc\genHyper.m Line: 332 Column: 15
Expected a variable, function, or constant, found ")".I think it may be the "bits()", I don't know how to deal with it.

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

Inspired: Generation of Random Variates

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!