expanding complex formulas



Hi,

Am trying to expand formulas with complex values.
E.g.:

(%i1) declare(b,complex);
(%o1)                                done
(%i2) (a+b)^2;
                                          2
(%o2)                              (b + a)
(%i3) expand(%i2);
                                 2            2
(%o3)                           b  + 2 a b + a
(%i4) realpart(expand(%i2));
                      2                                2       2
(%o4)         realpart (b) + 2 a realpart(b) - imagpart (b) + a
(%i5) 

But this seems to be wrong.

As far as I know (a+b.i)^2 would be something like:
re: a^2-y^2
im: 2.a.b.i

What am I doing wrong?


Folkert van Heusden

-- 
----------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE, www.vanheusden.com