I would like to write an operator oper
that acts on a pure function f
with an undetermined number of arguments, with the syntax oper[n][f]
to give another pure function, where n
is an integer. The point of this is to be able compose the operator like this:
oper[n2][oper[n1][f]]
The function f
is a polynomial in all its arguments, and oper[f]
will also be a polynomial. Here is what oper
is supposed to do for the case where $f$ takes three arguments:
$$\text{oper}[1][f](x,y,z) = [f(x,y,z)-f(0,y,z)]/x$$ $$\text{oper}[2][f](x,y,z) = [f(x,y,z)-f(x,0,z)]/y$$ $$\text{oper}[3][f](x,y,z) = [f(x,y,z)-f(x,y,0)]/z$$
It's supposed to take the difference of $f$ with itself but with the $n$th argument set to zero, and then divide the difference by the $n$th argument.
In general $f$ can have any number of arguments.
Bonus: How about defining the composition like this: oper[n1,n2,...][f]
, instead of oper[
…[oper[n2][oper[n1][f]]]
…]
?