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]
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]
ComplexEpxpand
does it and Assumptions
does not?
$\endgroup$
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
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]
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$
Commented
Sep 22, 2018 at 23:30
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] *)