Q:

Function I have defined evaluates slowly when called

I need to call some function defined in a subsection of some section of mathematica's .nb file. The code of its evaluation and displaying looks like
f[x_,y_,z_,t_] := Integrate[...]
f[x,y,z,t]

I need to use this function in another subsection of the same section. First, in order to check whether it is called correctly in this subsection, I just need to display it, so I write
f[x,y,z,t]

I expect immediate displaying, since the function is already defined and evaluated. But sometimes the time for displaying is comparable with the time of evaluating the integral from the first subsection! What are general reasons for this and how to avoid this? 
P.S. I don't attach the precise code since I don't understand what to attach (i.e., what is relevant).

A:

You're explicitly re-evaluating the function f[x,y,z,t], so it's computing the integral a second time. This is because SetDelayed (:=) holds its right-hand side in an unevaluated form. The simplest way to recall the result is to store it in another symbol, i.e. int = f[x,y,z,t] where you can then call int and the result will be displayed. Or you can do f[x_,y_,z_,t_] := Evaluate[Integrate[...]].
You can also have a look at the article in the documentation Functions That Remember Values They Have Found.

