MathGroup Archive 2006

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

Search the Archive

simple timing question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg69920] simple timing question
  • From: dimmechan at yahoo.com
  • Date: Wed, 27 Sep 2006 06:05:25 -0400 (EDT)

Hi.

Consider the following user defined function to calculate integrals
with
possible singulaties at the end points

improperIntegrate[f_, x_, a_, b_] := With[{integral = Integrate[f, x]},
Limit[integral,
x -> b, Direction -> 1] - Limit[integral, x -> a, Direction -> -1]]

Then

Timing[improperIntegrate[1/(2*x - 1)^(2/3), x, 1/2, 3]]
{0.07800000000000001*Second, (3*5^(1/3))/2}

Using directly Integrate almost 5 times more time is neeeded.

Timing[Integrate[1/(2*x - 1)^(2/3), {x, 1/2, 3}]]
{0.406*Second, (3*5^(1/3))/2}

For me it sounds normally that Integrate needed more time.
However I am looking for a clear explanation if possible.

I believe it has to do that using directly Integrate much time is spent
for checking
for singularities (here 1/2). Am I right or/and there is another
reason?

Thanks in advance.


  • Prev by Date: Re: How to remove just the outermost braces of a list?
  • Next by Date: RE: Mapping Functions That Take More Than One Argument
  • Previous by thread: Re: Executing function in mathematica function problem
  • Next by thread: Re: simple timing question