How to integrate products of hypergeometric functions and rational functions?

3 views (last 30 days)
Hello, I am a physics student and I am new to Matlab. I am trying to solve definite integrals involving the product of confluent first order hypergeometric functions and rational functions as follows:
p=0,1,2.... Where p=0,1,2,3...
When using the Matlab "integral" command the computation of these integrals takes a long time. The question is whether there is any routine in Matlab that does quick calculations of integrals that decay very quickly to zero.
Thank you very much for reading, excuse my English I am using a translator.
  2 Comments
David Goodmanson
David Goodmanson on 14 Sep 2020
Hi Nicolas,
what do you consider to be slow? For p = 0, this takes about 0.1 sec. on my PC. For p > 0, how are you determining the derivative of 1/(q^2+lambda^2) ?
Nicolas Legnazzi
Nicolas Legnazzi on 15 Sep 2020
Hello, thank you very much for your reply. To determine the derivative I apply the command "diff" and iterate it a number p of times. By putting the variables that I quote as m and n in the statement equal to 1 and choosing p = 1 on my PC it takes approximately 10 minutes to calculate that integral.

Sign in to comment.

Accepted Answer

David Goodmanson
David Goodmanson on 16 Sep 2020
Hello Nicolas,
I don't know how you are implementing the nth derivative of 1/(lambda^2 + q^2) but it is obviously very time consuming. The method below calculates the nth derivative algebraically and takes about as much time as for the zeroth derivative, about 0.1 sec on my PC. That's with moderate values for m, n, alpha, beta, lambda.
lambda = 1.2;
alpha = 2.3;
beta = 3.4;
m = 2;
n = 3;
F = @(q) lorentzdiff(5,q,lambda).*hypergeom(m,3/2,-alpha*q.^2).*hypergeom(n,3/2,-beta*q.^2);
J = integral(F,0,inf)
% ------------------
function yn = lorentzdiff(n,x,a)
% nth derivative wrt 'a' of the Lorentian 1/(x^2+a^2),
% as a function of x for fixed scalar 'a'
%
% function yn = lorentzdiff(n,x,a)
yn = (-1)^(n)*(factorial(n)./x).*imag((1./(a-i*x)).^(n+1));
ind = abs(x) < 1e-6*a;
yn(ind) = (-1)^n*factorial(n+1)/a^(n+2);
end
  2 Comments
Nicolas Legnazzi
Nicolas Legnazzi on 2 Oct 2020
Hi, I recently resumed this program and was wondering. How did you go about calculating algebraically the derivative of the code you sent me?

Sign in to comment.

More Answers (0)

Categories

Find more on Special Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!