Here we will use a trickof using Evaluate[] in a function definition to save time--a small diversion here will demonstrate why this is efficient

In[11]:=

Timing[f[c_] := Evaluate[Integrate[Exp[Tan[x]], {x, 0, c}]]]

Out[11]=

{7.77699 Second, Null}

In[12]:=

Timing[g[c_] := Integrate[Exp[Tan[x]], {x, 0, c}]]

Out[12]=

{0.000033 Second, Null}

In[13]:=

? f

Global`f

In[14]:=

? g

Global`g

g[c_] := ∫_0^c^Tan[x] x

In[15]:=

Timing[f[0.5]]

Out[15]=

{0.000934 Second, 0.65721 + 5.55112*10^-17 }

In[16]:=

Timing[g[0.5]]

Out[16]=

{0.126128 Second, 0.65721 + 5.55112*10^-17 }


Created by Mathematica  (October 31, 2005) Valid XHTML 1.1!