Refine works with symbols in either way:
Refine[Sqrt[x^2], Element[x, Reals]]
(* Abs[x] *)
Refine[Sqrt[x^2], x > 0]
(* x *)
But assuming positive-valued arbitrary function f[x] does not work. (Real-valued f[x] works, though.)
Refine[Sqrt[f[x]^2], Element[f[_], Reals]] (*Works*)
(* Abs[f[x]] *)
Refine[Sqrt[f[x]^2], f[_] > 0] (Does not work)
(* Sqrt[f[x]^2] *)
How can I correctly assume that f is a positive-valued unary function?





Assumingis not doing anything. You get the same result with justPowerExpand[Sqrt[f[x]^2]]– Bob Hanlon Nov 29 '23 at 15:46Assuming[f[_] < 0, PowerExpand[Sqrt[f[x]^2]]]still givesf[x]as output. This is because the default option value ofAssumptionsofPowerExpandis not$AssumptionsbutAutomatic, whileAssumingonly influences value of$Assumptions. (See Details section of document ofPowerExpandfor more info. ) BTW, if you writePowerExpand[Sqrt[f[x]^2], Assumptions -> f[_] < 0], the output will beE^(I \[Pi] Floor[1/2 - Arg[f[x]]/\[Pi]]) f[x], still undesired. – xzczd Dec 01 '23 at 00:59