Calculating Integration including Gamma Function
2 次查看(过去 30 天)
显示 更早的评论
Hi,
I am new to Matlab. I want to calculate the function in the following link. v, delta and L are given. How to calculate this using Matlab?
Thanks in advance
Pagolmon
0 个评论
回答(2 个)
John D'Errico
2011-1-23
Use a loop to create each term, summing the result as you go. A while loop allows you to do this, with a test inside the while statement to see if the terms are sufficiently small. Or, use a for loop, with a test inside the loop, then a call to break when the terms are sufficiently small.
Compute the terms using the log of each terms, then exponentiate each term before you sum it into the running sum. Gammaln here will be efficient to compute the log of the gamma function, but also the log of the factorial. The avoids partial underflows and overflows inside the terms because you use logs.
Beyond that, just start writing. The way to learn is to write the code yourself. If I do it for you, then you learn nothing.
Walter Roberson
2011-1-23
I ran this through a bunch of transformations, and the only one that resulted in any kind of simplification was to rewrite the first term in terms of the binomial function:
sum((1-delta)^n*(GAMMA(v+n, x/delta)/GAMMA(v+n))^L*binomial(v+n-1, n), n = 0 .. infinity)
If you have constraints upon the delta, v, or L values, then it might perhaps be possible to make a further refinement. For example are any of the variables constrained to be positive integers? Is L at least an integer even if possibly negative?
2 个评论
Walter Roberson
2011-1-24
I investigated further yesterday with L=2 and assumed integral v, but nothing I found could reduce the complexity of the summation in any meaningful form.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!