14
$\begingroup$

I have the following norm

Norm[{a, b*c}]

(* Sqrt[Abs[a]^2 + Abs[b c]^2] *)

How do I remove the Abs from it?

FullSimplify[Norm[{a, b*c}], Assumptions -> {a > 0, b > 0, c > 0}]

only kills the first Abs

Sqrt[a^2 + Abs[b c]^2]
$\endgroup$
0

3 Answers 3

15
$\begingroup$
expr = Norm[{a, b*c}]

Sqrt[Abs[a]^2 + Abs[b c]^2]

Since ComplexExpand assumes all its variables to be real, we automatically get what we want.

ComplexExpand@expr

Sqrt[a^2 + b^2 c^2]

Other methods include

Refine[expr, {a > 0, b c > 0}]

Sqrt[a^2 + b^2 c^2]

and

FunctionExpand[expr, {a > 0, b c > 0}]

Sqrt[a^2 + b^2 c^2]

$\endgroup$
2
  • 2
    $\begingroup$ Thx. Can you explain why ComplexEpxpand does it and Assumptions does not? $\endgroup$
    – chr
    Commented Sep 22, 2018 at 20:33
  • 2
    $\begingroup$ ComplexExpand automatically assumes all its variables to be real. Other than that, I believe it's just a matter of behind-the-scenes expression manipulation (i.e. I don't know...). Though this idea reminds me of this post talking about different ways of assuming things (granted in relation to Integrate). $\endgroup$ Commented Sep 22, 2018 at 20:48
11
$\begingroup$

If you have to use FullSimplify or Simplify, you can use the option ComplexityFunction to make expressions with Abs more costly:

FullSimplify[Norm[{a, b*c}], Assumptions -> {a > 0, b > 0, c > 0}, 
  ComplexityFunction -> (100 Count[#, _Abs, {0, Infinity}] +  LeafCount[#] &)]

 Sqrt[a^2 + b^2 c^2]

$\endgroup$
2
  • 3
    $\begingroup$ And the reason that ComplexityFunction is needed in this case is because LeafCount /@ {Sqrt[a^2 + Abs[b*c]^2], Sqrt[a^2 + b^2*c^2]} evaluates to {14, 15}, i.e., the apparent simpler form is not simpler. $\endgroup$
    – Bob Hanlon
    Commented Sep 22, 2018 at 23:30
  • 1
    $\begingroup$ @BobHanlon, great point. $\endgroup$
    – kglr
    Commented Sep 22, 2018 at 23:31
5
$\begingroup$

Also, for a real number x, Abs[x] = Sqrt[x^2]

Norm[{a, b*c}] /. Abs[x_] :> Sqrt[x^2]

(* Sqrt[a^2 + b^2 c^2] *)
$\endgroup$

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.