How to integrate products of hypergeometric functions and rational functions?

2 visualizzazioni (ultimi 30 giorni)
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 Commenti
David Goodmanson
David Goodmanson il 14 Set 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 il 15 Set 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.

Accedi per commentare.

Risposta accettata

David Goodmanson
David Goodmanson il 16 Set 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 Commenti
Nicolas Legnazzi
Nicolas Legnazzi il 16 Set 2020
Thank you very much!! I'm testing it right now and I'm sending you the results
Nicolas Legnazzi
Nicolas Legnazzi il 2 Ott 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?

Accedi per commentare.

Più risposte (0)

Categorie

Scopri di più su Special Functions in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by