MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

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


  • Prev by Date: Re: Working with ppatterns
  • Next by Date: Fitting the solution of a differential equation to a data set
  • Previous by thread: Re: Table of tables
  • Next by thread: Re: Table of tables