version 1.0.0.0 (3.47 KB) by
Stepan Yanchenko

Computes confluent hypergeometric function 1F1 for complex parameters a, b and complex variable z.

3 Downloads

Updated 19 Oct 2006

No License

KUMMERCOMPLEX(a,b,z) is the confluent hypergeometric function 1F1 (Kummer function) for complex parameters a, b and complex variable z.

In general case the program calculates the sum of convergent series defining the function until the next term becomes too small (in comparison with the sum of all previous terms). The case of large abs(z) is considered separately (e.g., see 13.5.1 in Abramowitz, Stegun "Handbook of special functions", 1964). Some simple cases of integer parameter values are considered separately as well.

The function controls the loss of precision and makes check for insufficient number of members in the series. It prints warning if there are any problems. Otherwise, if everything is ok, the results seem to coincide with Matematica 4.1 with 10-digit precision.

This function is largely based at "Fortran library of special functions" which was converted to Matlab.Unfortunatey, the library can compute confluent hypergeometric function only for real values of a and b. So this file may be considered as its generalization for complex a and b.

This function also requires cgama.m file which computes Gamma function for complex variables. This file was taken from just the same "Fortran library" and insignificantly modified.

Stepan Yanchenko (2020). Confluent hypergeometric function (Kummer function) (https://www.mathworks.com/matlabcentral/fileexchange/12665-confluent-hypergeometric-function-kummer-function), MATLAB Central File Exchange. Retrieved .

Created with
R13

Compatible with any release

**Inspired by:**
Computation of Special Functions

**Inspired:**
Generation of Random Variates

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

Start Hunting!Create scripts with code, output, and formatted text in a single executable document.

Rui ZhangI'm not sure whether the script can fit in all cases, but I get the right results with it.

ChristophThis script seems to be totally wrong.

Mathematic

->HypergeometricU[3, 2, 1.]

->0.105479

Matlab2010b

->vpa(feval(symengine,'kummerU',3,2,1))

->0.105478956

->kummercomplex(3,2,1)

->4.0774

Does not fit at all.

Yongningnot accurate

check

Hypergeometric1F1[1.0 + 0.0 i, 2 , 2.652198009530852 i]

RishabSome time I encouter the following error/warning while using the function:

!!!Warning!!! Only the first 0 digits are correct

Any idea why this is happening ?

Great ResearchAbsolutely wrong code. Should be immediately deleted as it doest not work at all.

Harsh NandanHi,

I am solving a structural dynamics problem which makes use of fractional integral of exp(alpha*t) which in turns makes use of hypergeometric function. I was earlier using hypergeom function from matlab but as it is based on symbolic tool it is bit slow. I came across this function and was trying out this function I get the following error when this function is used with following values:

KummerComplex(1.00,1.3333,-2.4179 + 13.2744i)

while

hypergeom(1.00,1.3333,-2.4179+13.2744i) = 0.0364 + 0.0287i

even Hypergeometric1F1 in mathematica gives the same value as hypegeom.

Can someone help regarding this?

Thanks for writing this function :)

Regards

Nandan

Yong LeDear Dr. Stepan Yanchenko

I have used this Matlab program in my paper. So , I should acknowledge you. Can you send me your department and institution? , which may be wrote in my paper.

Do you have interest in solving another difficult problem.

How can we compute the special function ---Hermite function Hv(x).

The Hermite function satisfy the differential equation y''-2xy'+2ny =0.

It should point out that HermiteH[n,x] can be computed in mathematic with any complex parameters n and x.

If you can extend n and x to any complex parameters in Matlab, it will be much contribute to Matlab users.

I very expect that you can solve this problem.Thus, many problem can be solved in Matlab.

Thank you very much for your consideration.

Please Email to me...

Olavo SilvaI have made a translation to Fortran code (double precision) and found some problems. For the values (a=-2i,b=1,z=-2ik, for k=10,11,12,...,20) the program was unable to calculate the value (the end of the loop up to 500 steps was reached). The program has warned correctly, though. Is there any possibility to overcome this problem (blind regions in the domain of z)?

Olavo SilvaThe routine is very good. I only regret that there is no Fortran code for it, since it was this code version that I would be most needing. Is there any possibility to find this routine in fortran (anywhere, with anyone)?

Luca BalbiThe math is fine, not so for the error handling.

Returning 'error', which actually results in a vector of doubles, when there is a problem is very misleading.

An error, or warning should be raised instead.

Astha SethiIt is very nice

Stepan YanchenkoDear Kinshuk Jerath,

Could you please be more specific and provide some example when my function is wrong. I tested it quite thoroughly but of course one can never be sure that absolutely everything is right. I will be most grateful if you tell me about the bugs you found.

And just to show that things are not that bad I'm providing some examples (KUMMERCOMPLEX is my matlab function, Hypergeometric1F1 is the Mathematica 4.1 one, and I'm just copy-pasting calculation results from those programs).

KUMMERCOMPLEX(1,2,3) gives 6.36184564106256

Hypergeometric1F1[1, 2, 3] // N gives 6.3618456410625

KUMMERCOMPLEX(-2.2,5.1,-3.7) gives 3.19551384468581

Hypergeometric1F1[-2.2, 5.1, -3.7] // N gives 3.1955138446858085

KUMMERCOMPLEX(1.23+0.05i,0.56+20.8i,-3.5+5.3i) gives 1.29354319463094 + 0.38941235708149i

Hypergeometric1F1[1.23 + 0.05\[ImaginaryI],

0.56 + 20.8\[ImaginaryI], -3.5 + 5.3\[ImaginaryI]] // N gives 1.293543194630939 + 0.3894123570814895 \[ImaginaryI]

So in examples of these kinds everything seems to be correct.

May be you were unlucky to check at something like this:

Hypergeometric1F1[1, 100, 5] // N

Warning! In this example the Mathematica 4.1 program gives wrong result! I contacted their developers and they recognized this bug.

Another one of their bugs is:

Hypergeometric1F1[-500, 1, 1] // N

Their result is wrong, because of precision loss and their program gives no warnings about that.

Anyway you can always check things by straight series calculations.

Good luck!

Best regards, Stepan Yanchenko.

Kinshuk JerathDoes not match Mathematica results for simple cases even!!