The same function the second time evaluated is faster. Why?
- To: mathgroup at smc.vnet.net
- Subject: [mg119076] The same function the second time evaluated is faster. Why?
- From: Guillermo Sanchez <guillermo.sanchez at hotmail.com>
- Date: Sat, 21 May 2011 06:47:34 -0400 (EDT)
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