Re: The same function the second time evaluated is faster. Why?
- To: mathgroup at smc.vnet.net
- Subject: [mg119113] Re: The same function the second time evaluated is faster. Why?
- From: DrMajorBob <btreat1 at austin.rr.com>
- Date: Sun, 22 May 2011 06:54:36 -0400 (EDT)
Why not? Is it a problem?
Bobby
On Sat, 21 May 2011 05:47:34 -0500, Guillermo Sanchez
<guillermo.sanchez at hotmail.com> wrote:
> Dear gurus?
>
> I evaluate the below function ,
>
> Int[1]:=1+1
>
> Int[2]:=Timing[(f2[x1_] := Integrate[Sin[x^3], {x, 0, x1}];
> f2[Range[10]]);]
> Out[2]:= {12.261, Null}
>
> I repeat the evaluation is faster
>
> Out[2]:={1.389, Null}
>
> and the third faster
>
> Out[3]:= {0.281, Null}
>
> Even writting f3 instead f2
>
> Timing[(f3[x1_] := Integrate[Sin[x^3], {x, 0, x1}]; f3[Range[10]]);]
> {0.281, Null}
>
> Why the second and third evaluation are faster?
>
> Guillermo
>
--
DrMajorBob at yahoo.com