Re: Maping and Complex Addition
- To: mathgroup at smc.vnet.net
- Subject: [mg56130] Re: Maping and Complex Addition
- From: Peter Pein <petsie at arcor.de>
- Date: Sat, 16 Apr 2005 03:52:16 -0400 (EDT)
- References: <d3o0aq$bmi$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Pratik Desai wrote:
> I have a list of complex conjugate numbers , appearing as
> comp={a+b*I,a-b*I,c+d*I,c-d*I}
>
> I would like to create a function ConjPlus[{}] which gives me the real
> values obtained by adding the first two complex conjugate numbers and so
> on. I have been able to do it using table and plus, but it would be cool
> to just have a function you can call
>
> Anyway, here is what I am using
> Table[Plus@@Partition[comp,2][[q]],{q,1,j}]
>
You almost got it:
comp = {a + b*I, a - b*I, c + d*I, c - d*I};
myFunc = Plus @@@ Partition[#, 2]&;
In[3]:= myFunc[comp]
Out[3]= {2*a, 2*c}
--
Peter Pein
Berlin