Re: complex output for real integral
- To: mathgroup at smc.vnet.net
- Subject: [mg115867] Re: complex output for real integral
- From: Bill Rowe <readnews at sbcglobal.net>
- Date: Sun, 23 Jan 2011 05:36:37 -0500 (EST)
On 1/22/11 at 3:23 AM, tsariysk at craft-tech.com (Ted Sariyski) wrote:
>I get complex answer for an integral from Exp[1/x^3]/x^3 over the
>real axes:
>In[]:=f[n_] = Assuming[
>{Element[x, Reals], Element[n, Integers], n >= 1},
>Integrate[E^(1/x^3)/x^3, {x, n, Infinity}]
>]
>Out[]:= 1/6 (-1)^(1/3) (-3 Gamma[5/3] + 2 Gamma[2/3, -(1/n^3)])
>The imaginary part of f[n] is everywhere ~10^-16 and I could
>ignore it but I guess there is a better approach.
You could use Chop, i.e.
In[7]:= ans = 1/6 (-1)^(1/3) (-3 Gamma[5/3] + 2 Gamma[2/3, -(1/n^3)]);
In[8]:= Chop[ans /. n -> 1 // N]
Out[8]= 0.781197
But this is essentially the same as ignoring it.
Note, the reason you are seeing this is due to the limitations
of machine precision arithmetic. That is:
In[9]:= Im[N[ans /. n -> 1, 50]]
Out[9]= 0``50.25775441372254
Demonstrating the true value of the imaginary part is zero.