Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: Weighted histogram

  • To: mathgroup at
  • Subject: [mg62269] Re: Weighted histogram
  • From: "Ray Koopman" <koopman at>
  • Date: Fri, 18 Nov 2005 05:57:57 -0500 (EST)
  • References: <dliv00$g1b$>
  • Sender: owner-wri-mathgroup at

kalymereau at wrote:
> Hi MathGroup
> With Histogram[{a1,a2,...,an}] one can represent the histogram of
> values in a list. I have a (classical) problem where each value ai has
> to be weighted by some real positive value wi. What is the simplest way
> to represent the histogram of values {a1,a2,...,an} ponderated by a
> list {w1,w2,...,wn} ?
> Thanks
> Geronimo

a = Table[Random[Integer,{1,9}], {n = 100}];
w = Table[-Log[Random[]],{n}];
p = #/Tr@#&[ Tr@Pick[w,a,#]& /@ Range[Min@a,Max@a] ];
Histogram[p, FrequencyData->True]

  • Prev by Date: Re: DXF, OSG and Mathematica (OpenGL)
  • Next by Date: NDSolve
  • Previous by thread: Weighted histogram
  • Next by thread: Re: Weighted histogram