Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2004

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

Search the Archive

Re: Sum of list elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49331] Re: Sum of list elements
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Wed, 14 Jul 2004 07:29:39 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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