MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: (Not trivial) Definite Integration of a rational function

  • To: mathgroup at smc.vnet.net
  • Subject: [mg74770] Re: (Not trivial) Definite Integration of a rational function
  • From: "Valeri Astanoff" <astanoff at gmail.com>
  • Date: Wed, 4 Apr 2007 04:10:14 -0400 (EDT)
  • References: <euslob$9nf$1@smc.vnet.net>

On 3 avr, 06:38, "dimitris" <dimmec... at yahoo.com> wrote:
> I think it is time to open a new thread about integration, isn't it?
>
> Anyway...Here we go..(Mathematica 5.2 is used).
>
> f = HoldForm[Integrate[(2*x)/((x + 1)*(x^3 + 3*x^2 + 2*x + 1)), {x, 0,
> Infinity}]]
>
> We have
>
> ReleaseHold[f /. Integrate[h_, {x_, a_, b_}] :> Plot[h, {x, a, 10}]]
> (*plot*)
>
> ReleaseHold[f /. Integrate -> NIntegrate] (*numerical estimation with
> machine precision*)
> 0.3712169752602472
>
> Attempts to get an analytic result failed.
>
> Timing[ReleaseHold[f]]
> {145.969*Second, Integrate[(2*x)/((1 + x)*(1 + 2*x + 3*x^2 + x^3)),
> {x, 0, Infinity}]}
>
> Timing[ReleaseHold[f /. Integrate[h___] :> Integrate[h,
> GenerateConditions -> False]]]
> {144.765*Second, Integrate[(2*x)/((1 + x)*(1 + 2*x + 3*x^2 + x^3)),
> {x, 0, Infinity}, GenerateConditions -> False]}
>
> (
>
> BTW, Mathematica version 4 returns Infinity for this definite
> integral. I think this happens because a partial fraction
> decomposition is performed and the integrand is written
>
> Apart[(2*x)/((x + 1)*(x^3 + 3*x^2 + 2*x + 1))]
> -(2/(1 + x)) + (2*(1 + 2*x + x^2))/(1 + 2*x + 3*x^2 + x^3)
>
> and after it integrates definitely each term of last sum
>
> (Integrate[#1, {x, 0, Infinity}] & ) /@ %
> Integrate::idiv: Integral of 1/(1 + x) does not converge on
> {0,Infinity}.
> Integrate::idiv: Integral of (1 + x)^2/(1 + 2*x + 3*x^2 + x^3) does
> not \
> converge on {0,Infinity}.
> Integrate[-(2/(1 + x)), {x, 0, Infinity}] + Integrate[(2*(1 + 2*x +
> x^2))/(1 + 2*x + 3*x^2 + x^3), {x, 0, Infinity}]
>
> One additional curious thing is it doesn't show the relevant warning
> message for convergence...
> )
>
> Let see the antiderivative
>
> ReleaseHold[f /. Integrate[h_, {x_, a_, b_}] :> Integrate[h, x]]
> Together[D[%, x]]
> Plot[%%, {x, 0, 10}]; (*plot*)
>
> 2*(-Log[1 + x] + RootSum[1 + 2*#1 + 3*#1^2 + #1^3 & , (Log[x - #1] +
> 2*Log[x - #1]*#1 + Log[x - #1]*#1^2)/
>       (2 + 6*#1 + 3*#1^2) & ])
> (2*x)/((1 + x)*(1 + 2*x + 3*x^2 + x^3))
>
> I wonder why Mathematica since it gets the indefinite integral, it
> fails to evaluate
> the definite integral. Any ideas?
>
> Since both the integrand and the antiderivative posses no
> singularities/discontinuities
> in the integration range I proceed to get the definite integral by
> application of the Newton-Leibniz
> formula
>
> This time we get finally the definite integral
>
> Timing[Limit[F, x -> Infinity] - Limit[F, x -> 0]]
> Simplify[%[[2]]]
> N[%]//Chop
>
> {176.90699999999998*Second, -2*RootSum[1 + 2*#1 + 3*#1^2 + #1^3 & ,
>     (Log[-#1] + 2*Log[-#1]*#1 + Log[-#1]*#1^2)/(2 + 6*#1 + 3*#1^2)
> & ]}
>
> -2*RootSum[1 + 2*#1 + 3*#1^2 + #1^3 & , (Log[-#1] + 2*Log[-#1]*#1 +
> Log[-#1]*#1^2)/(2 + 6*#1 + 3*#1^2) & ]
>  0.37121697526024766
>
> But timings like this look quite unreasonable for integrals like this
> (at least for me!).
>
> Do you have other ideas of getting this definite integral (with better
> time performances
> if possible)?
>
> It is also looks quite strange that in two other CAS (the one can be
> freely downloaded from Internet)
> I got directly the definite integral in a couple of seconds.
>
> Any explanation about previous time performance of Limit will be
> greatly appreciate.
>
> Trying to write down the result
>
> -2*RootSum[1 + 2*#1 + 3*#1^2 + #1^3 & , (Log[-#1] + 2*Log[-#1]*#1 +
> Log[-#1]*#1^2)/(2 + 6*#1 + 3*#1^2) & ]
>
> in a expanded format (i e no RootSum object; of course I am aware that
> it will be lost the compacteness
> that RootSum offers) I tried
>
> Tr[Simplify[(-2*((Log[-#1] + 2*Log[-#1]*#1 + Log[-#1]*#1^2)/(2 + 6*#1
> + 3*#1^2)) & ) /@
>     (x /. Solve[(1 + 2*#1 + 3*#1^2 + #1^3 & )[x] == 0, x])]]
> Chop[N[%]]
>
> -((2*(12 + 2^(1/3)*(27 - 3*Sqrt[69])^(2/3) + 6*3^(1/3)*(2/(9 -
> Sqrt[69]))^(2/3))*
>      Log[1 + (2/(27 - 3*Sqrt[69]))^(1/3) + ((1/2)*(9 -
> Sqrt[69]))^(1/3)/3^(2/3)])/
>     (3*(6 + 2^(1/3)*(27 - 3*Sqrt[69])^(2/3) + 6*3^(1/3)*(2/(9 -
> Sqrt[69]))^(2/3)))) -
>   (2*(8*I*(9 - Sqrt[69])^(2/3) + 2^(1/3)*3^(1/6)*(2*2^(1/3)*3^(1/6)*(-
> I + Sqrt[3]) +
>        (9 - Sqrt[69])^(1/3)*(-9 - 3*I*Sqrt[3] + I*Sqrt[23] +
> Sqrt[69])))*
>     Log[1 + (-1 + I*Sqrt[3])/(2^(2/3)*(27 - 3*Sqrt[69])^(1/3)) - ((1 +
> I*Sqrt[3])*((1/2)*(9 - Sqrt[69]))^(1/3))/(2*3^(2/3))])/
>    (3*(4*I*(9 - Sqrt[69])^(2/3) + 2^(1/3)*3^(1/6)*(2*2^(1/3)*3^(1/6)*(-
> I + Sqrt[3]) +
>        (9 - Sqrt[69])^(1/3)*(-9 - 3*I*Sqrt[3] + I*Sqrt[23] +
> Sqrt[69])))) -
>   (2*(8*(9 - Sqrt[69])^(2/3) + 2^(1/3)*3^(1/6)*(2*I*2^(1/3)*3^(1/6)*(I
> + Sqrt[3]) +
>        (9 - Sqrt[69])^(1/3)*(-9*I - 3*Sqrt[3] + Sqrt[23] +
> I*Sqrt[69])))*
>     Log[1 + (-1 - I*Sqrt[3])/(2^(2/3)*(27 - 3*Sqrt[69])^(1/3)) + (I*(I
> + Sqrt[3])*((1/2)*(9 - Sqrt[69]))^(1/3))/(2*3^(2/3))])/
>    (3*(4*(9 - Sqrt[69])^(2/3) +
> 2^(1/3)*3^(1/6)*(2*I*2^(1/3)*3^(1/6)*(I + Sqrt[3]) +
>        (9 - Sqrt[69])^(1/3)*(-9*I - 3*Sqrt[3] + Sqrt[23] +
> I*Sqrt[69]))))
> 0.3712169752602468
>
> Am I missing something simpler than this setting?
> Is it a built -in function that RootSum and this function acts like
> the pair {RootReduce,ToRadicals} below?
>
> Reduce[1 + 2*x + 3*x^2 + x^3 == 0, Reals]
> ToRadicals[%]
> RootReduce[%]
>
> x == Root[1 + 2*#1 + 3*#1^2 + #1^3 & , 1]
> x == -1 - (2/(3*(9 - Sqrt[69])))^(1/3) - ((1/2)*(9 - Sqrt[69]))^(1/3)/
> 3^(2/3)
> x == Root[1 + 2*#1 + 3*#1^2 + #1^3 & , 1]
>
> Thanks!
>
> Dimitris

Good day,

This is my [non-orthodox] way to help mma get an exact result:

In[1]:=xx = x /. Solve[(x^3+3*x^2+2*x+1) == 0];

In[2]:=xx//N
Out[2]={-2.324717957244746,-0.3376410213776268-0.5622795120623013*I,-0.3376410213776268+0.5622795120623013*I}

In[3]:=t=(x-a)(x-(b-I*c))(x-(b+I*c));

In[4]:=bc=First@Solve[b+c*I == xx[[2]] && b-c*I == xx[[3]]];

In[5]:=(i=Integrate[2x/((x+1)t),{x,0,\[Infinity]},
Assumptions->a<0 && b<0 && c<0])//Timing

Out[5]={5.531*Second,-((2*(1+a)*(-c^2+(a-b)*(b+b^2+c^2))*ArcTan[b/c]
+2*a*c*((1+b)^2+c^2)*Log[-a]-
(1+a)*((-c^2+(a-b)*(b+b^2+c^2))*Pi+c*(a+b^2+c^2)*Log[b^2+c^2]))/
((1+a)*c*((a-b)^2+c^2)*((1+b)^2+c^2)))}

In[6]:=(i /. a -> xx[[1]] /. bc//Sim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t[23]*(27-3*Sqrt[69])^(2/3)+
7*2^(1/3)*3^(1/6)*(9-Sqrt[69])^(2/3)))/(6*(9-Sqrt[69])^(4/3)))])))}

In[7]:=%//N
Out[7]={4.813 Second, 0.371217}

In[8]:=$Version
Out[8]=5.1 for Microsoft Windows(January 28,2005)

V.Astanoff



  • Prev by Date: Re: Series and order
  • Next by Date: "cannot find the required native library named JLinkNativeLibrary" with 64-bit Linux and Java
  • Previous by thread: Re: (Not trivial) Definite Integration of a rational function
  • Next by thread: Re: (Not trivial) Definite Integration of a rational function