开发者

Mathematica, Arg and Simplify

I've got problems in using Mathematica with complex numbers. Am I doing something wrong?

Two examples:

  1. ComplexExpand[(x + I y)^(1/2)] yields开发者_高级运维 (x^2 + y^2)^(1/4) Cos[1/2 Arg[x + I y]] + I (x^2 + y^2)^(1/4) Sin[1/2 Arg[x + I y]]

    and I've found no way so far to get a simpler result (which does exist!)

  2. ComplexExpand[Sqrt[x^2 + y^2] Cos[Arg[x + I y]] + I Sqrt[x^2 + y^2] Sin[Arg[x + I y]]]

    yields the same result of the argument of ComplexExpand, while it should obviously be x + I y !

Thanks in advance!


For the second one, remember that Mathematica can't make assumptions on your symbols, so a "number" is complex by default.

That's the reason why when you enter:

a = Sqrt[x^2 + y^2] Cos[Arg[x + I y]] + I Sqrt[x^2 + y^2] Sin[Arg[x + I y]];
ComplexExpand@a

you get

Sqrt[x^2 + y^2] Cos[Arg[x + I y]] +  I Sqrt[x^2 + y^2] Sin[Arg[x + I y]]

or if you enter

FullSimplify@a

you get

E^(I Arg[x + I y]) Sqrt[x^2 + y^2]

Just because Mathematica doesn't know that X and Y are REALS.

But you can explicitly declare it, so Mathematica is allowed to treat them as reals numbers.

Try this:

a = Sqrt[x^2 + y^2] Cos[Arg[x + I y]] + I Sqrt[x^2 + y^2] Sin[Arg[x + I y]];
$Assumptions = Element[x, Reals] && Element[y, Reals]
FullSimplify[a]

and you'll get

x + I y   

Remember that resetting your $Assumptions only needs

$Assumptions = True

But in general, don't expect Mathematica will render complex numbers the way you want them...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜