AW: Sum of list elements

• To: mathgroup at smc.vnet.net
• Subject: [mg49317] AW: [mg49313] Sum of list elements
• From: Matthias.Bode at oppenheim.de
• Date: Tue, 13 Jul 2004 05:54:07 -0400 (EDT)
• Sender: owner-wri-mathgroup at wolfram.com

```Hello Erik,

In[22]:=
lst01 = {2, 2, 1}

Out[22]=
{2, 2, 1}

In[23]:=
sum01 = Plus @@ lst01

Out[23]=
5

In[24]:=
lst01/sum01

Out[24]=
{2/5, 2/5, 1/5}

Best regards,
Matthias Bode
Sal. Oppenheim jr. & Cie. KGaA
Untermainanlage 1
D-60329 Frankfurt am Main
GERMANY
Tel.: +49(0)69 71 34 53 80
Mobile: +49(0)172 6 74 95 77
Fax: +49(0)69 71 34 95 380
E-mail: matthias.bode at oppenheim.de
Internet: http://www.oppenheim.de

-----Ursprüngliche Nachricht-----
Von: spam at husumtoften.invalid [mailto:spam at husumtoften.invalid]
Gesendet: Dienstag, 13. Juli 2004 10:33
An: mathgroup at smc.vnet.net
Betreff: [mg49313] Sum of list elements

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 Rnne

```

• Prev by Date: Re: KS Analysis In Mathematica
• Next by Date: Re: customizing Integrate with Unprotect
• Previous by thread: RE : Sum of list elements
• Next by thread: User-defined or filled symbols for Points in ListPlots and Epilogs?