# Do I need to clear all definitions whenever I experiment with new parameter values?

Do I have to clear all my definitions whenever I experiment with different parameter values for my model? For example, I have a simple model as follows:

w[t_]:=w[t]=w[t-1]+h
w[0]=0
h = 5


I want to do:

Table[w[t], {t, 0, 10}]


with varying h. But every time I change h, I have to clear the definitions with

Clear["Global*"]


Otherwise, the result for w[t] remains the same. This practice is ok with this simple model. But when the model is pretty big, it really is time-consuming. I was expecting to get a new result directly by changing h. Any helpful comments in this direction?

-
Could you use w[t_,h_] instead of setting h afterward ? –  William Briand Mar 13 '14 at 20:20
@WilliamBriand, thanks. I can try. But my actual model is pretty big with so many parameters. So it would be impossible to put all of them into the bracket. –  ppp Mar 13 '14 at 20:31
@Kuba, thanks. I think that's what I did. You can see h gets value at the end. –  ppp Mar 13 '14 at 21:17
Enclosing things in Dynamic allow for post hoc update of variables -- though it may make it considerably slower to run. –  William Briand Mar 13 '14 at 21:26

You could just clear the DownValues you don't want.
w[t_] := w[t] = w[t - 1] + h

{{0, 2, 4, 6}, {0, 3, 6, 9}, {0, 4, 8, 12}, {0, 5, 10, 15}}
`