MathGroup Archive 2005

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

Search the Archive

Re: Weighted histogram

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