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 年 9 月 16 日
Thank you very much!! I'm testing it right now and I'm sending you the results
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 Center および File ExchangeSpecial Functions についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by