Making functions with the output of a ReplaceAll

Make each element of replace a function by wrapping it with Function.

functions = Function /@ replace

{(αu #1)/(ku + #1) &, Du #1 &, (αv #1)/(kv + #1) &}

Use functions with Through to apply all functions to the same argument:

Through[functions@1]

{αu/(1 + ku), Du, αv/(1 + kv)}

Use Map to apply this function to a list of arguments:

Through[functions@#] & /@ {1, 2}

{{αu/(1 + ku), Du, αv/(1 + kv)},
{(2 αu)/(2 + ku), 2 Du, (2 αv)/(2 + kv)}}

Alternatively, map Function on reactions before you create replace:

reactions2 = Function /@ reactions;
replace2 = {a, c, d} /. reactions2;
Through[replace2@#] & /@ {1, 2}

same result


Using your original definitions:

fn = Function @@ {replace};

fn[2]
{(2 αu)/(2 + ku), 2 Du, (2 αv)/(2 + kv)}
fn /@ {1, 2}
{{αu/(1 + ku), Du, αv/(1 + kv)}, {(2 αu)/(2 + ku), 2 Du, (2 αv)/(2 + kv)}}
fn @ {1, 2}
{{αu/(1 + ku), (2 αu)/(2 + ku)}, {Du, 2 Du}, {αv/(1 + kv), (2 αv)/(2 + kv)}}

Tags:

Functions