Re: Little(?) problem: What is the formula ???

• To: mathgroup at smc.vnet.net
• Subject: [mg21941] Re: Little(?) problem: What is the formula ???
• From: Dr Dan <drdanw at my-deja.com>
• Date: Sat, 5 Feb 2000 00:49:16 -0500 (EST)
• References: <87e194\$s01@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Here is the quick answer (Version 4 only):

WeightedSum[s_] := Tr[Apply[Times, s, {1}]];
UnweightedSum[s_] := Tr[s[[All,2]]];
WeightedFraction[s_] := WeightedSum[s]/UnweightedSum[s];

In[35]:=
serie2 = {{0.1, 100}, {0.12, 200}, {0.15, 300}};
WeightedFraction[serie2]

Out[36]=
0.131667

Sorry I don't have time to go into why this works today, but here is a
tip:  In Mathematica, think in terms of "operations performed on a
list" rather than "operations performed in a loop."

In article <87e194\$s01 at smc.vnet.net>,
"Nijntje ?" <a.vanrossem at bellt-gca.nl> wrote:
> Hello All !
>
> I have two "series" of data :
> The first serie are "normal values"
> The seccond serie represents a percentage(Value) of an amount
(Nominator)
>
> Serie 1)
> Value  Nominator
> 100  1
> 150  1
> 125  1
>
> Serie 2)
> Value  Nominator
> 10  100
> 12  200
> 15  300
>
> The Problem:
> ----------------------------------------------------------------------
----
> I want to find a GENERAL formula to calculate the SUM of these series,
> So a formula which gives the following results
>
> Serie 1)   365
> Serie 2)   13,1
>
> Explanation results:
> Serie 1) 100+150+125 = 375
>
> serie 2)   10% of 100 = 10
>   12% of 200 = 24
>   15% of 300 = 45
> So total amount = 600 and the fraction=79 so that is 13.1%
>
> What is the general formula  (using value and nominator) ?????????
>
> Thank you very much !!!
>
>

Sent via Deja.com http://www.deja.com/

```

• Prev by Date: Re: numeric inverse laplace transform of numeric data
• Next by Date: Re: Word processing in Mathematica?
• Previous by thread: Re: Little(?) problem: What is the formula ???
• Next by thread: Re: Little(?) problem: What is the formula ???