10
$\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$
12
$\begingroup$
ComplexExpand@Norm@{a, b c}

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

$\endgroup$
  • 2
    $\begingroup$ Thx. Can you explain why ComplexEpxpand does it and Assumptions does not? $\endgroup$ – chr Sep 22 '18 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$ – That Gravity Guy Sep 22 '18 at 20:48
8
$\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$
  • 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 Sep 22 '18 at 23:30
  • 1
    $\begingroup$ @BobHanlon, great point. $\endgroup$ – kglr Sep 22 '18 at 23:31
3
$\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, privacy policy and cookie policy

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