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