Mathematica 9 is now available
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

Sum of list elements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg49313] Sum of list elements
  • From: spam at husumtoften.invalid (Per Rønne)
  • Date: Tue, 13 Jul 2004 04:32:49 -0400 (EDT)
  • Reply-to: spam at husumtoften.dk (Per Rønne)
  • Sender: owner-wri-mathgroup at wolfram.com

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]

-- 
Per Erik Rønne


  • Prev by Date: Use of a rational tiling group in sl(2,R) to get a 3d surface
  • Next by Date: Re: Matrix Manipulation: deletion of rows and columns
  • Previous by thread: Use of a rational tiling group in sl(2,R) to get a 3d surface
  • Next by thread: Re: Sum of list elements