MathGroup Archive 2005

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

Search the Archive

Re: Maping and Complex Addition

  • To: mathgroup at smc.vnet.net
  • Subject: [mg56151] Re: Maping and Complex Addition
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Sat, 16 Apr 2005 03:53:47 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 4/15/05 at 4:47 AM, pdesai1 at umbc.edu (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}]

This of course won't do anything useful as j is not defined. Presumably, j was defined elsewhere in you session as 2. In anycase the identical result is obtained from

Plus@@@Partition[comp,2]

and the following makes the desired function

conjPlus[x_List]:=Plus@@@Partition[x,2]

An alternative (which may run faster) would be using Total as in

conjPlus[x_List]:= Total/@Partition[x, 2]


--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Can anyone please help with this mathematica code
  • Next by Date: Re: What's the matter with this?
  • Previous by thread: Re: Maping and Complex Addition
  • Next by thread: Re: Maping and Complex Addition