MathGroup Archive 2004

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

Search the Archive

Re: Sum of list elements


On 7/13/04 at 4:32 AM, spam at husumtoften.invalid (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}.

Probably the most direct way of obtaining the sum of a list of elements would be to Apply Plus to the list, i.e.,

Plus@@list

For lists that are vectors

Tr[list]

will work as well and executes faster
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: a noise with a better histogram
  • Next by Date: Re: Sum of list elements
  • Previous by thread: Re: Re: Sum of list elements
  • Next by thread: Re: Sum of list elements