MathGroup Archive 2007

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

Search the Archive

Re: strange behavior of Integrate

  • To: mathgroup at smc.vnet.net
  • Subject: [mg75311] Re: strange behavior of Integrate
  • From: dimitris <dimmechan at yahoo.com>
  • Date: Wed, 25 Apr 2007 05:29:10 -0400 (EDT)
  • References: <200704220910.FAA20220@smc.vnet.net><f0kc45$r3t$1@smc.vnet.net>

>Using a code by Chris Chiasson I see that Integrate does use
>FullSimplify  in this integral


>Developer`ClearCache[]
>Block[{$Output = {OpenWrite["C:\\msgStream.m"]}},
>TracePrint[(1/Pi)*Integrate[Log[x/(x^2 + 1)]*(1/(x^2 + 1)^m), {x, 0, Infin=
ity},
>Assumptions -> m >= 1], TraceInternal -> True]; Close /@ $Output];
>Thread[Union[Cases[ReadList["C:\\msgStream.m",
>HoldComplete[Expression]], symb_Symbol /; AtomQ[Unevaluated[symb]] &&
>Context[Unevaluated[symb]] === "System`" :> HoldComplete[symb], {0,
>Infinity},  Heads -> True]], HoldComplete]

Adding the following codes one can see directly the extended use of
Simplify and
the limited use of FullSimplify by Integrate

Unprotect[FullSimplify];
FullSimplify[a___] := Null /; (Print[InputForm[fullsimplify[a]]];
False)

Unprotect[Simplify];
Simplify[a___] := Null /; (Print[InputForm[simplify[a]]]; False)

E=2Eg.

Integrate[1/Sqrt[Sin[x]], {x, 0, Pi/2}]

(*output is ommited*)

Dimitris

=CF/=C7 dimitris =DD=E3=F1=E1=F8=E5:
> >The difference in result is a subtle interaction between use of caching
> >for certain intermediate results, and use of time constraints in some
> >places (nobably simplifications). In effect a simplification attempt
> >might time out the first attempt but succeed in later tries due to
> >having more intermediate computations precomputed and cached.
>
> Very clear explanation. I learn some new things. Hence, I really
> appreciate your response.
>
> >Integrate does make (very limited) use of FullSimplify.
>
> I didn't know this. Thanks for pointing me out.
>
> Using a code by Chris Chiasson I see that Integrate does use
> FullSimplify
> in this integral
>
> Developer`ClearCache[]
> Block[{$Output = {OpenWrite["C:\\msgStream.m"]}},
>    TracePrint[(1/Pi)*Integrate[Log[x/(x^2 + 1)]*(1/(x^2 + 1)^m), {x,
> 0, Infinity}, Assumptions -> m >= 1],
>      TraceInternal -> True]; Close /@ $Output];
> Thread[Union[Cases[ReadList["C:\\msgStream.m",
> HoldComplete[Expression]],
>     symb_Symbol /; AtomQ[Unevaluated[symb]] &&
> Context[Unevaluated[symb]] === "System`" :> HoldComplete[symb], {0,
> Infinity},
>     Heads -> True]], HoldComplete]
>
> (*outout is ommited*)
>
> MemberQ[FullSimplify, -1]
> True
>
> >Why is this integral important?
>
> > > int = HoldForm[(1/Pi)*Integrate[Log[x/(x^2 + 1)]*(1/(x^2 + 1)^m), {=
x,=
> 0, Infinity}, Assumptions -> m >= 1]]
>
> I study the book "Irresistible Integrals" by George Boros and Victor
> Moll
> (2nd Edition, Campridge University Press 2006).
> I work various formulas by hand and Mathematica from this book and one
> of worked examples is this integral (page 270).
>
> (BTW, very good performance of Mathematica)
>
> Is is a good reason or not?
>
> Best Regards
> Dimitris
>
>
>
> Daniel Lichtblau
> Wolfram Research
>
>
> =CF/=C7 Daniel Lichtblau =DD=E3=F1=E1=F8=E5:
> > dimitris wrote:
> > > Hi fellas.
> > >
> > > In my travel (sic!) through definite integration I encountered a
> > > strange
> > > behavior (at least!) of Integrate. Of course may be this is something
> > > well known but I haven't notice any relevant before. So I apologize
> > > if I discuss an old issue.
> > >
> > > Anyway, here we go...
> > >
> > > $VersionNumber
> > > 5.2
> > >
> > > Consider the integral
> > >
> > > In[1]:=
> > > int = HoldForm[(1/Pi)*Integrate[Log[x/(x^2 + 1)]*(1/(x^2 + 1)^m), {=
x,
> > > 0, Infinity}, Assumptions -> m >= 1]]
> > >
> > > Here is the definite integral by Mathematica
> > >
> > > In[2]:=
> > > res1 = int // ReleaseHold
> > > Infinity::indet: Indeterminate expression 0*Infinity encountered.
> > >
> > > Out[2]=
> > > -((1/(4*Pi*Gamma[m]))*((-3 + 2*m)*Sqrt[Pi]*Gamma[-(3/2) +
> > > m]*(PolyGamma[0, 1 - m] - PolyGamma[0, 3/2 - m]) +  Gamma[-(1/2) +
> > > m]*(4^(1 + m)*m*Gamma[-2*m]*Gamma[m]*Gamma[1/2 + m] +
> > >       Sqrt[Pi]*(EulerGamma + Log[4] + PolyGamma[0, -(1/2) + m]))))
> > >
> > > Observe first the Infinity::indet message.
> > >
> > > Despite the presence of the warning message the result is correct.
> > > [...]
> > > At this point, someone may believe that the strange behavior I was
> > > talking about is this
> > > warning message. Even though the presence of this message needs some
> > > discussion,
> > > (although they are known cases where Built in functions generate
> > > warning messages
> > > in spite of the results being correct) the next issue is by far more
> > > interesting.
> > >
> > > Just evaluate AGAIN the integral
> > >
> > > In[10]:=
> > > res2=int//ReleaseHold
> > >
> > > Infinity::indet: Indeterminate expression 0*Infinity encountered.
> > > Out[10]=
> > > (Gamma[-(1/2) + m]*(2*HarmonicNumber[1/2 - m] - HarmonicNumber[-(3/2)
> > > + m] - Log[4] - 2*(EulerGamma + PolyGamma[0, m]) +  2*Pi*Tan[m*Pi]))/
> > > (4*Sqrt[Pi]*Gamma[m])
> > >
> > > Integrate returns a different output for the same definite
> > > integration!
> > > The result is of course correct.
> > > [...]
> > > but I wonder how is this possible this!
> > >
> > > Note that
> > >
> > > In[15]:=
> > > FullSimplify[res1]
> > > Simplify[res2 == %]
> > > [...]
> > > whereas for example
> > >
> > > In[17]:=
> > > FunctionExpand[res1]
> > > [...]
> > > It seams that the second time Integrate called FullSimplify!
> > >
> > > But I think Integrate uses Simplify and not FullSimplify.
> > >
> > > Any insight, explanations available?
> > >
> > > Dimitris
> >
> > The difference in result is a subtle interaction between use of caching
> > for certain intermediate results, and use of time constraints in some
> > places (nobably simplifications). In effect a simplification attempt
> > might time out the first attempt but succeed in later tries due to
> > having more intermediate computations precomputed and cached.
> >
> > Integrate does make (very limited) use of FullSimplify.
> >
> > Why is this integral important?
> >
> > Daniel Lichtblau
> > Wolfram Research



  • Prev by Date: Re: writting an expression
  • Next by Date: simplification
  • Previous by thread: Re: Re: strange behavior of Integrate
  • Next by thread: Integration Question