MATLAB: Integral of exp(-x)*P(x)/Q(x) in terms of exponential integral in symbolic tooblox

exponential integralSymbolic Math Toolbox

I am trying to find an analytical soltuion to the integral
I= int(exp(-x)*P(x)/Q(x),x,0,inf)
where P and Q are both polynnomials and P/Q is bounded at infinity. An example is:
syms a x
int(x*exp(-a*x)/(x^2+1),x,[0 inf])
This gives:
piecewise(angle(a) in Dom::Interval([-pi/2], [pi/2]) & a ~= 0, (2*meijerG([-1/2, 0, 0], [], 0, [], 4/a^2))/(a^2*pi^(1/2)), ~angle(a) in Dom::Interval([-pi/2], [pi/2]) | a == 0, int((x*exp(-x*a))/(x^2 + 1), x, 0, Inf))
This is just one example but am I doing something wrong here or is the Symbolic Toolbox limited in this respect?

Best Answer

What is the concern with the result that was returned? It looks like the SMT came back with the best answer it could with the information it was given. The form of the result would be a bit simpler by putting assumptions on 'a' if sensible to do so:
>> syms a positive
>> int(x*exp(-a*x)/(x^2+1),x,[0 inf])
ans =
(2*meijerG(1, [], [1, 1, 3/2], [], a^2/4))/(a^2*pi^(1/2))
But until a value is assigned to 'a' what shold the expected result be? Of course, the integral can be evaluated at a value of interest:
>> f(a)=int(x*exp(-a*x)/(x^2+1),x,[0 inf])
f(a) =
(2*meijerG(1, [], [1, 1, 3/2], [], a^2/4))/(a^2*pi^(1/2))
>> vpa(f(5))
ans =
0.033896