Code covered by the BSD License  

Highlights from
Confluent hypergeometric function

5.0

5.0 | 3 ratings Rate this file 23 Downloads (last 30 days) File Size: 1.69 KB File ID: #29766

Confluent hypergeometric function

by Patrick

 

17 Dec 2010 (Updated 13 Jun 2011)

Solves Kummer's differential equation.

| Watch this File

File Information
Description

This function estimates the solution to Kummer's differential equation within a specified tolerance. Kummer's differential equation is given by:

    x*g''(x) + (b - x)*g'(x) - a*g(x) = 0

The code executes a while loop to calculate the generalized hypergeometric series within a specified tolerance.

Supports inputs of x in the form of a scalar, row vector, or column vector.

MATLAB release MATLAB 7.10 (2010a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (5)
09 May 2011 Frederic  
09 May 2011 Frederic

Works very well and is very fast. One quick suggestion for those wanting vector 'x' arguments:
[...]
ar = [1 a a+[1:N-1]]; br = [1 b b+[1:N-1]];
fact = cumprod(ar)./cumprod(br)./factorial([0:N]);
for i = 1:length(x)
f(i) = fact*[x(i).^[0:N]]';
end

14 May 2011 Patrick

Hello Frederic,
Your suggestion to handle vector inputs is a good one. However, I am trying to avoid for loops to realize the speed. I was trying to include the ability to handle vector inputs in the original submission but couldn't figure out how to do it at the time.

I just submitted an update to the code that handles column vector inputs for x and avoids for loops. I'm not sure how long it takes for the review process, but keep an eye out for it if you're interested.

20 May 2011 Frederic

Awesome; thanks a lot -- my suggestion was naive.
I haven't tried yet but I peeked at the updated code and I'll give it a shot later on.

23 Mar 2012 Michael Todd

Very nice, thank you.

Please login to add a comment or rating.
Updates
14 May 2011

Modified code to be able to handle column vector inputs for x.

13 Jun 2011

Changed the code to calculate the solution using a while loop to a specified tolerance. The while loop is is both faster and more accurate than the vector multiplication method I was using before.

Tag Activity for this File
Tag Applied By Date/Time
confluent Patrick 20 Dec 2010 08:22:30
hypergeometric Patrick 20 Dec 2010 08:22:30
kummer Patrick 20 Dec 2010 08:22:30

Contact us at files@mathworks.com