Am 29.09.2012 09:09, schrieb zahava.ginny at gmail.com:
> An assignment using SetDelayed, lhs := rhs, maintains rhs in completely unevaluated form.
> Thus, if k=5, say, the assignment
>
> In[1] = f[k,j_]:=rhs[k,j]
>
> yields
>
> In[2] = ?f
> Global`f
> f[5,j_]:=rhs[k,j]
>
> How can I force the k on the right hand side to be evaluated so that ?f will yield
> f[5,j_]:=rhs[5,j] ?
>
> Of course, I could define f[5,j_] manually, but I want to automate the procedure over a range of values of k.
>
Look at what With can do for you:
Do[
With[{k=k},
f[k,j_]:=rhs[k,j]
],{k,1,10}]
hth,
albert