How to integrate products of hypergeometric functions and rational functions?

2 次查看(过去 30 天)
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 个评论
David Goodmanson
David Goodmanson 2020-9-14
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 2020-9-15
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.

请先登录,再进行评论。

采纳的回答

David Goodmanson
David Goodmanson 2020-9-16
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 个评论
Nicolas Legnazzi
Nicolas Legnazzi 2020-10-2
Hi, I recently resumed this program and was wondering. How did you go about calculating algebraically the derivative of the code you sent me?

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Special Functions 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by