MathGroup Archive 2004

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

Search the Archive

Re: Re: Sum of list elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49324] Re: [mg49315] Re: [mg49313] Sum of list elements
  • From: DrBob <drbob at bigfoot.com>
  • Date: Wed, 14 Jul 2004 07:29:30 -0400 (EDT)
  • References: <200407130923.FAA10334@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Plus@@A

can also be written as any of these:

Tr@A
Tr[A]
Total@A
Total[A]

Total is new in version 5.

Bobby

On Tue, 13 Jul 2004 05:23:18 -0400 (EDT), Ravinder Kumar B. <ravi at crest.ernet.in> wrote:

> It is easy to acheive using Map (@@) function as follows:
>
> A={1,2,3,4,5};
> B=A/Plus@@A;
> gives the desired result
> B={1/15,2/15,3/15,4/15,5/15}
>
>
>
> On Tue, 13 Jul 2004, Per Rønne wrote:
>
>> I'm trying to find a function [possibly a way to make a function] which
>> calculate the sum of the elements of a list.
>>
>> Right now, the purpose is to find the relative distribution of the
>> elements of a list. That is, I need a way to get out that the
>> distribution of:
>>
>> {2, 2, 1}
>>
>> is
>>
>> {2/5, 2/5, 1/5}.
>>
>> Had I been able to get the sum of the list elements in this way:
>>
>> Sum[{2, 2, 1}]
>>
>> it could had been done with:
>>
>> l = {2, 2, 1}
>> l / Sum[l]
>>
>>
>



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: A question about function
  • Next by Date: User-defined or filled symbols for Points in ListPlots and Epilogs?
  • Previous by thread: Re: Sum of list elements
  • Next by thread: Re: Sum of list elements