Re: Table of tables
- To: mathgroup at smc.vnet.net
- Subject: [mg113258] Re: Table of tables
- From: Sebastian Schmitt <sschmitt at physi.uni-heidelberg.de>
- Date: Thu, 21 Oct 2010 07:00:58 -0400 (EDT)
Hi Luiz!
Luiz Melo wrote:
> Given
>
> t = {{{-1, -1, -2+2I}, {-1, -1, 3-I}}, {{-1, -1, 4+I}, {-1, -1, -5-5I}}};
>
> how can I extract the imaginary part of the complex elements to obtain
>
> {{{-1, -1, 2}, {-1, -1, -1}}, {{-1, -1, 1}, {-1, -1, -5}}};
What about:
Function[{e}, If[Im[e] == 0, e, Im[e]], Listable][t]
There seems to be no ComplexQ therefore I test with "Im[e] == 0" if it
is not a complex number.
Cheers,
Sebastian