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 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