Re: Complex Numbers to list of points
- To: mathgroup at smc.vnet.net
- Subject: [mg72236] Re: Complex Numbers to list of points
- From: "dimitris" <dimmechan at yahoo.com>
- Date: Fri, 15 Dec 2006 07:06:39 -0500 (EST)
- References: <elosbs$ojk$1@smc.vnet.net>
({Re[#1], Im[#1]} & ) /@ {1 + 3*I, 2, 1 - 3*I}
{{1, 3}, {2, 0}, {1, -3}}
Dimitris
Ï/Ç planetmarshalluk at hotmail.com Ýãñáøå:
> Hi there,
>
> I have a list of mixed complex and real numbers returned from a function, e=
> g
>
> {1+3i, 2, 1-3i}
>
> I wish to convert the list to a list of points.
>
> {1+3i,2,1-3i} /. z_Complex->{Re[z],Im[z]}
>
> gives
>
> {{1,3},2,{1,-3}}
>
> Which is almost what I want, but has not dealt with the possibility of non-=
> complex numbers in the list. Is there a compact way of doing this, such wit=
> h a list of rules? Nothing obvious seems to work, the only success I have h=
> ad is splitting the list into real and complex sublists, applying rules to =
> each list individually and then recombining them, which seems like an awful=
> lot of hard work.
>
> What I want is
> toPoints[{1+3i, 2, 1-3i}] == {{1,3},{2,0},{1,-3}}
>
> Any help appreciated,
> Thanks.
>
> Andrew.