Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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]
share|improve this question
    
FullSimplify[Sqrt[f[x]^2], _Symbol \[Element] Reals] /. Abs[v_] -> v –  george2079 May 23 at 19:07

3 Answers 3

up vote 1 down vote accepted

Try this:

FullSimplify[Sqrt[f[x]^2], TransformationFunctions -> {Automatic, PowerExpand}]
share|improve this answer
    
That's exactly the kind of fix I've been looking for! Big thanks! –  Ranza May 30 at 22:23

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
share|improve this answer
    
I'd like it to work with any function, not just a function with "a" and "x" –  Ranza May 23 at 16:08

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      *)
share|improve this answer
    
Nice, but could have unpredictable consequences.. –  Ranza May 30 at 22:25

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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