# Assumption on the range of a function

I'm using value-defined function as set of parameter, i.e.

f[1] ===> first parameter
f[2] ===> second parameter
f[3] ===> third parameter


etc. I would like to tell Mathematica that all these parameters are positive. I tried something like

FullSimplify[Abs[f[1]],Assumptions-> {f[x_]>0}]


and I get

Abs[f[1]]


f[1]


Of course here I posted just an example, the function I have to simplify in my case is much more complicated. How can I do?

• Have you tried creating a list of assumptions like Thread[Table[f[i], {i, fmin, fmax}] > 0]? – Feyre Aug 14 '16 at 11:41
• Interestingly using f[1] > 0 in Assumptions does work. Doesn't pattern matching work here, and if so, why? – kirma Aug 14 '16 at 11:45
• Of course this is a solution but in my program I don't know the range of the parameters. I want to tell Mathematica that every value of the function is positive. – MaPo Aug 14 '16 at 11:47
• @MaPo A way I see (not sure whether it fits your need in your more general case) would be to define an UpValue for f, either with f /: Abs[fun : f[_]] := fun or with Abs[fun : f[_]] ^:= fun. This will evaluate Abs[f[1]] to f[1], for instance, without the need of using Assumptions and FullSimplify. – user31159 Aug 14 '16 at 14:44
• Related: (6182), (42607), (58271), (67343), (79301), (79756), (94983) – Mr.Wizard Aug 15 '16 at 1:05

This constructs assumptions by finding all occurrences of pattern f[_] in the expression being simplified:
FullSimplify[#, Cases[#, v : f[_] :> v > 0, Infinity]] &[

• +1 Or more succinctly: Simplify[#, Cases[#, v : f[_] :> v > 0, Infinity]] &[ Abs[f[f[1]]] + Abs[f[x]]] – Bob Hanlon Aug 14 '16 at 14:57