14

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]
Jack LaVigne
  • 14,462
  • 2
  • 25
  • 37
chr
  • 175
  • 1
  • 6

3 Answers3

15
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]

NonDairyNeutrino
  • 7,810
  • 1
  • 14
  • 29
  • 2
    Thx. Can you explain why ComplexEpxpand does it and Assumptions does not? – chr Sep 22 '18 at 20:33
  • 2
    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). – NonDairyNeutrino Sep 22 '18 at 20:48
11

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]

kglr
  • 394,356
  • 18
  • 477
  • 896
  • 3
    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. – Bob Hanlon Sep 22 '18 at 23:30
  • 1
    @BobHanlon, great point. – kglr Sep 22 '18 at 23:31
5

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] *)
Bob Hanlon
  • 157,611
  • 7
  • 77
  • 198