Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: V8 slow like a snail

  • To: mathgroup at smc.vnet.net
  • Subject: [mg127726] Re: V8 slow like a snail
  • From: "Dr. Wolfgang Hintze" <weh at snafu.de>
  • Date: Fri, 17 Aug 2012 03:43:24 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-newout@smc.vnet.net
  • Delivered-to: mathgroup-newsend@smc.vnet.net
  • References: <20120815073325.F37376842@smc.vnet.net> <k0i2mv$1e0$1@smc.vnet.net>

On 16 Aug., 08:07, Murray Eisenberg <mur... at math.umass.edu> wrote:
> You said for which values of m you timed this, but what values of n?
>
> On Aug 15, 2012, at 3:33 AM, Dr. Wolfgang Hintze <w... at snafu.de> wrote:
>
> > f1[n_, m_] :=
> > Integrate[n t^m Exp[-n t] (Exp[t] - 1)^(n - 1), {t, 0, \[Infinity]},
> >  Assumptions -> {{n, m} \[Element] Integers, m >= 0, n > 0}]
>
> ---
> Murray Eisenberg                             =
        mur... at math.umass.edu
> Mathematics & Statistics Dept.
> Lederle Graduate Research Tower      phone 413 549-1020 (H)
> University of Massachusetts                  413 545-28=
59 (W)
> 710 North Pleasant Street                      fax =
  413 545-1801
> Amherst, MA 01003-9305

Murray,

no value of n was specified, as I am interested in symbolic
calculation, and
in the time the two versions need.

I'll show the example m=1

Version 8:
Timing[Integrate[n*t*Exp[(-n)*t]*(Exp[t] - 1)^(n - 1), {t, 0,
Infinity}]]
{30.840999999999994,
ConditionalExpression[HarmonicNumber[n], Re[n] > -1]}

So v8 is able to perform the symbolic calculation and needs in 30.84
seconds.
Using the Assumptions -> {{n, m} \[Element] Integers, m >= 0, n > 0}
leads
to the same result in 30.43 seconds

Now version 5.2:
Timing[Integrate[n*t*Exp[(-n)*t]*(Exp[t] - 1)^(n - 1), {t, 0,
Infinity}]]
{0.5 Second,  n If[Re[n] > -1, HarmonicNumber[n]/n,   Integrate[E^(-n
t) (-1
+ E^t)^(-1 + n) t, {t, 0, \[Infinity]}, Assumptions -> Re[n] <= -1]]}

so it does the job with the same result (including a suggestion about
the
assumptions) as v8 but 60 times faster!

With the Assumptions:
{0.109 Second, HarmonicNumber[n]}

hence v5.2 now is even 30/0.11 = 270 times faster than version 8.

My point is that I'm observing factors of 60 or 270 longer calculation
times
for version 8 in comparison to version 5.2

The integrals of my example are by no means exotic. They are just the
m-th
moments of the maximum of n independent exponentially distributed
random
variables.

My second example I put already in my first reply to the newsgroup (I
repeat
it here for ease of reference):

Version 8:
Timing[f = FullSimplify[Integrate[Log[Abs[(Tan[x] + Sqrt[7])/(Tan[x]
-
Sqrt[7])]], {x, Pi/3, Pi/2}]]]
{3191.391, Integrate[Log[Abs[(Sqrt[7] + Tan[x])/(Sqrt[7] - Tan[x])]],
{x,
Pi/3, Pi/2}]}

Hence no result (and no comments) in about one hour.

Version 5.2
Timing[f = FullSimplify[Integrate[
     Log[Abs[(Tan[x] + Sqrt[7])/(Tan[x] - Sqrt[7])]], {x, Pi/3, Pi/
2}]]]
{32.667*Second, (1*(-9*ArcCot[Sqrt[7]]*Log[2] - (Pi -
6*ArcCot[Sqrt[7]])*
      Log[-Sqrt[3] + Sqrt[7]] + Pi*Log[Sqrt[3] + Sqrt[7]] +
     3*I*(-PolyLog[2, (-Sqrt[3] + Sqrt[7])/(-I + Sqrt[7])] +
       PolyLog[2, (-Sqrt[3] + Sqrt[7])/(I + Sqrt[7])] +
       PolyLog[2, (-I + Sqrt[7])/(Sqrt[3] + Sqrt[7])] -
       PolyLog[2, (I + Sqrt[7])/(Sqrt[3] + Sqrt[7])])))/6}

so v 5.2 gives the result in terms of known functions and needs only
half a
minute.
Can the difference be larger?

Again the integral was not selected by some "malicious" procedure,
instead
it appeared just recently in my Spanish group of recreational
mathematics
(es.ciencia. matematicas).

Best regards,
Wolfgang



  • Prev by Date: Re: Remote kernel, SSH and macintosh
  • Next by Date: Re: compact notation for NonCommutativeMultiply that supports cut and paste
  • Previous by thread: Re: V8 slow like a snail
  • Next by thread: Re: V8 slow like a snail