Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Hypergeometric functions and how to use them in Matlab?

730 views
Skip to first unread message

DRG

unread,
Sep 29, 2009, 8:13:59 AM9/29/09
to
This question might be more suited for a special functions forum, but
I'll try here because I need to implement! I have a function, that,
when integrated, gives a result that uses the hypergeometric function
2F1.. The original equation and resultant can be seen here;

http://integrals.wolfram.com/index.jsp?expr=(d^m)%2F((d^2+%2B+x^2)^(n))&random=false

The problem is that when I want to evaluate the integral for different
values of n,m,d and X, I do not know how to go about it and obtain a
numerical value. In essence, the term

2F1(1/2,n; 3/2; -x^2/d^2)

is causing quite a bit of confusion for me. Does anyone have a decent
grasp of such special functions, and would it be possible to get a
brief explanation? Furthermore, does matlab have routines that can
handle this Gaussian hypergeometric function ? Thanks in advance...

Charlie D.

unread,
Oct 6, 2009, 12:37:02 PM10/6/09
to
DRG <grim...@gmail.com> wants to compute 2F1(1/2,n; 3/2; -x^2/d^2)

The short answer is if you have the symbolic toolbox you can use HYPERGEOM. Otherwise...

The Gauss hypergeometric function has a power series representation with a radius of convergence R=1. This means that if |(x/d)| < 1, you can compute the value of the function up to machine precision by truncating the series with the appropriate number of terms. (Or, if your n is a negative integer then the series terminates as a finite polynomial regardless of the magnitude of x/d). Outside the radius of convergence the direct power series representation is not useful, though transformation formulas exist that allow one to use a different power series representation to compute the function depending on the value of the parameters and so forth. (If your n is a positive half-integer then you may be able to use transformation formulas in order to compute the 2F1 function as a finite polynomial). As you can probably guess, it is pretty complicated to code your own general-purpose
function for computing 2F1 covering all ranges of the parameters and independent variables.

Note that 2F1 can be used to represent many different types of functions, elementary and special. It is possible that the specific 2F1 that you are interested in has a relationship with other functions more easily computable in MATLAB. For example, the form you wrote looks very similar to the representation of the error function as a hypergeometric series. If that n wasn't there and it was instead the 1F1(1/2,3/2,-z^2) then you would have erf(z)./z. In any case, good sources of information on hypergeometric functions are: Abramovitz and Stegun; Lebedev; Mathai and Saxena.

Finally, note also that the HYPERGEOM function can be quite slow, though I think I remember seeing release notes sometime in the not too distant past about improving the speed of this function.

Good luck.

Charlie D.

unread,
Oct 6, 2009, 12:57:02 PM10/6/09
to
DRG <grim...@gmail.com> wrote
> http://integrals.wolfram.com/index.jsp?expr=(d^m)%2F((d^2+%2B+x^2)^(n))&random=false

BTW, I just looked at your integral: int((x^2+d^2)^-n,x). I would suggest for you to derive the solution for yourself by using the binomial expansion for (x^2+d^2)^-n and integrating term-by-term. You'll get a better feel for the role of the parameters. Just remember that the form of the binomial expansion will depend on whether x^2 > d^2 or the other way around.

0 new messages