2

I'm trying to generate an array of bell curve numbers with a certain number of buckets/discrete values between both ends. For example, I need 30 buckets, following bell curve distribution and add up to 1.0. The number in the first bucket and last bucket would be about 0.015, second 0.02 and so on.

Is there a function built into objective-c or an open source project that can help me generate a bell curve with n buckets?

Alex Stone
  • 46,408
  • 55
  • 231
  • 407
  • Hmmm....no built-in function jumps to mind. But I'll be interested if anyone knows of one. You can, of course, generate your own bell curve (with buckets) by "rolling" dice with the number of dice affecting the shape of the curve (and the number of buckets). A web search may give you examples. – Robotic Cat Jan 30 '14 at 15:45
  • 1
    Might help:http://stackoverflow.com/questions/8779843/generating-a-random-gaussian-double-in-objective-c-c – Woodstock Jan 30 '14 at 16:19
  • Seems to me that this is a math question, not a programming question. You're talking about the ["normal" or "Gaussian" distribution](http://en.wikipedia.org/wiki/Normal_distribution). See in particular the section on "numerical approximations". – Hot Licks Jan 30 '14 at 18:03
  • 3
    This question appears to be off-topic because it is about mathematics. – Hot Licks Jan 30 '14 at 18:03
  • The bell curve, a.k.a. the normal or Gaussian distribution, has an infinite range. Consequently, the two end buckets must each cover an infinite range in order for the middle set of buckets to have fixed sizes. Since there are an infinite number of possible endpoints for the range of those middle n-2 buckets, until you specify the endpoints the question has an infinite number of solutions. – pjs Jan 31 '14 at 15:04

1 Answers1

0

For a relatively small number of buckets, building a table of values would work just fine. You'd only need to do half the work, too, because it's symmetric.

pjs
  • 18,696
  • 4
  • 27
  • 56
  • This is what I have right now - about 90 lookup values pasted from excel. I would like to extend this by creating the nth value programmatically. – Alex Stone Feb 04 '14 at 00:12
  • In that case you need to specify some finite bounds for the endpoints. – pjs Feb 04 '14 at 00:24