Mathematica Asked on April 12, 2021
Here is what I have used for this.
From this link, Why do I get empty graph when adding ‘Abs’ function?
I know that I can remove Abs
with ComplexExpand
Input
ComplexExpand[Sqrt[1 - Abs[x]^2]]
Output
((1 - x^2)^2)^(1/4) Cos[1/2 Arg[1 - Abs[x]^2]] +
I ((1 - x^2)^2)^(1/4) Sin[1/2 Arg[1 - Abs[x]^2]]
However, it works just fine when I use Plus
in the Sqrt
.
Input
ComplexExpand[Sqrt[1 + Abs[x]^2]]
Output
Sqrt[1 + x^2]
Is there anyone who can explain this?
Maybe adding Simplify
gives you what you want.
ComplexExpand[Sqrt[1 - Abs[x]^2]] // Simplify
(*Piecewise[{{I*((x^2 - 1)^2)^(1/4), Abs[x] > 1}}, ((x^2 - 1)^2)^(1/4)]*)
or
$Assumptions = -1 < x < 1
ComplexExpand[Sqrt[1 - Abs[x]^2]] // Simplify
(*Sqrt[1 - x^2]*)
The plus case is different because the value inside the Sqrt
is always positive. It is generally a good idea to add Simplify
to any result ComplexExpand
returns.
Correct answer by Bill Watts on April 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP