Let $f$ be a function of $n$. I would like to define a function $A$ with module which takes $f[n]$ as input. So for example:
f[n_]:=f[n]=(n^2+1)/n;
A[f[n]_]:=A[f[n]]=Module[{d},
d[n_]=d[n]=Numerator[f[n-1]];
Return[d[n]]
]
My code above does not work. I want f[n] still be a function of n inside the module but it seems I did it wrong. Any help is appreciated.
f[n_], you can tryf = Function[n, (n^2 + 1)/n]. Then pass bothfandntoA:A[f_Function, n_] := ...– Marius Ladegård Meyer Jun 15 '16 at 06:08