Mugna
Mugna

Reputation: 59

Order symbolic output for complex number Maple 18

my problem concerns operation with complex number in Maple 18. The issue is the following i define this complex: c:=a+i*b; then i compute the square: sort(evalc(c^2)) and the output is: a^2+2*i*ab-b^2; So, how can i obtain an output like the following?
a^2-b^2b^2 +a*i*ab; In other word i want an output where the real part precede the complex part.

i have tried with sort command but it was not enough ... probably exixts some command to format the output in complex manner but i dont find that ...

thank you in advance :)

Upvotes: 0

Views: 173

Answers (1)

acer
acer

Reputation: 7271

In Maple 18 you could use the new InertForm package to get more control over the formatting.

The exact look will depend on the interface. In the commandline (TTY) interface both uses of Display below look the same, but both display with extra round brackets around the real part. In the Standard Java GUI the first one has a grey + to denote the inert %+.

restart:

c:=a+b*I:
expr:=c^2:

U := `%+`(evalc(Re(expr)),evalc(I*Im(expr))):

with(InertForm):

Display(U);

                            2    2
                          (a  - b ) + 2 I a b

Display(U, inert=false);

                            2    2
                          (a  - b ) + 2 I a b

Value(U);

                            2              2
                          -b  + 2 I a b + a

This is a new way of handling such issues. In older Maple the real and complex parts could have been kept separate in the display by being each wrapped with the ``() operator. And then the actual value could be re-obtained by applying the expand command to strip that off. That's not so nice, displaying with extra brackets even in the GUI.

Upvotes: 1

Related Questions