MathGroup Archive 2010

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

Search the Archive

Re: Table of tables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg113262] Re: Table of tables
  • From: Luiz Melo <luiz.melo at polymtl.ca>
  • Date: Thu, 21 Oct 2010 07:01:43 -0400 (EDT)

Thanks Sebastian and Valeri for the help.

I'm actually looking for a function that operates only on the third row of each
column-matrix terms(which happen to be complex in the example I gave), but
leaves the other terms intact. Consider a different example:

Let
t = {{{-1, -1, -2}, {-1, -1, -3}}, {{-1, -1, -4}, {-1, -1, -5}}};

how can I get

{{{-1, -1, 2}, {-1, -1, 3}}, {{-1, -1, 4}, {-1, -1, 5}}};

that is, in this case, I need a function that takes the Abs[] of the 3rd row of
each sub-matrix and leaves the other terms intact.

Regards,
Luiz



> 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: := vs = in some function definitions
  • Next by Date: Re: := vs = in some function definitions
  • Previous by thread: Re: Table of tables
  • Next by thread: Re: Table of tables