1
$\begingroup$

I'd like to pass an assumption to FullSimplify so whenever it gets a function that is squared and square rooted would return me only the function body, without Abs[f] (I've tried assumption _Symbol ∈ Reals && _Symbol > 0 but it gives Abs[f] instead of f.

f[x_] := a x^2;
FullSimplify[Sqrt[f[x]^2], _Symbol ∈ Reals && _Symbol > 0]
x^2 Abs[a]
$\endgroup$
1
  • $\begingroup$ FullSimplify[Sqrt[f[x]^2], _Symbol \[Element] Reals] /. Abs[v_] -> v $\endgroup$
    – george2079
    May 23, 2014 at 19:07

3 Answers 3

1
$\begingroup$

Try this:

FullSimplify[Sqrt[f[x]^2], TransformationFunctions -> {Automatic, PowerExpand}]
$\endgroup$
1
  • $\begingroup$ That's exactly the kind of fix I've been looking for! Big thanks! $\endgroup$
    – Ranza
    May 30, 2014 at 22:23
1
$\begingroup$

I'm not sure about the syntax you have used in the second argument of FullSimplify. How about the following

Clear@f
f[x_] := a x^2;
FullSimplify[Sqrt[f[x]^2], 
 x \[Element] Reals && x > 0 && a \[Element] Reals && a > 0]
a x^2
$\endgroup$
1
  • $\begingroup$ I'd like it to work with any function, not just a function with "a" and "x" $\endgroup$
    – Ranza
    May 23, 2014 at 16:08
0
$\begingroup$

Try this (for any symbols):

Unprotect[Greater];
SetAttributes[Greater, {Listable}];
f[x_] := b a x^2;
list = Cases[f[x], _Symbol];
FullSimplify[
 Sqrt[f[x]^2], _Symbol \[Element] Reals && And @@ Greater[list, 0]]

(*   a b x^2      *)
$\endgroup$
1
  • $\begingroup$ Nice, but could have unpredictable consequences.. $\endgroup$
    – Ranza
    May 30, 2014 at 22:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.