I have a set of arguments in a list like:

uy = {21/2 + y/2, 13.6667 + 0.666667 y, 20 + y}

Now, I want to assign a function (call it 'f(y)') to an element of that list:

f[y_] := uy[[1]][y]

It seems the way I define f(y) it's not correct. Any suggestions on how to define it properly?

Thank you very much

An in order to obtain a list of functions f? I mean:

For[i = 1, 4 > i,

 f[[i]][y_] = uy[[i]]; 

  • 2
    $\begingroup$ This is at least one case where one would want to use = instead of :=: Clear[y]; f[y_] = uy[[1]]. I am certain this is a dupe of a previous question, but I am unable to find it. $\endgroup$ Nov 13 '19 at 13:15

This creates a list of pure functions:

flist = Function[y, #] & /@ uy;

And then

f = flist[[1]]

Or directly:

f = Function@@{y, uy[[1]]}

Not the answer you're looking for? Browse other questions tagged or ask your own question.