Using Mathematica the definition of user functions , which return "pure functions" is quite easy
f[list_] := Function[t, Sin[list[[1]] t] + list[[2]] Cos[t]]
Plot[f[{2, 1}][t], {t, 0, 2 Pi}]
and often very useful. Please note the use of f[liste][time]
with separated argument brackets.
My question:
Is it possible to pre-compile the part f[list]
in such a way that it returns a pure function object?
here a small example to clarify my question:
pg[a_(*liste *)] := Interpolation[{{0, 0}, {.4, a[[1]]}, {.8, a[[2]]}, {1, 1}} , InterpolationOrder -> 1]
defines a polygon with two variable points. pg[a] is a pure function object
which can be used to find the polygon pg[a][x]~=x
opt = NMinimize[Sum[(trapez[{a, b}][x] - x)^2, {x, 0, 1, .2}], {a, b}]