Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: How to make weighted random numbers?
Replies: 7   Last Post: Feb 28, 2009 3:49 AM

 Messages: [ Previous | Next ]
 Ioannis Posts: 2,014 Registered: 12/13/04
Re: How to make weighted random numbers?
Posted: Feb 27, 2009 10:30 PM

Rich Grise wrote:

> Say, I want to fill a sphere uniformly with random dots; the logical way
> to do that in r,theta format; otherwise to make a sphere, you'd have to
> do some heroic math on the three dimension (or is there some
> quick-n-dirty formula that can do it in one flop, that they don't tell
> us high school (and Tech School, don't forget!) ?
>
> Either way. I don't want a uniform sphere - more like density through the
> center looks like a bell-shaped curve, i.e., denser in the middle?
>
> It's got to be computable, maybe with iterations, but that's what I
> do best! I just have no idea what the algorithm would be.
>
> What I'm up to is I have a 3-d drafting program and I want to approximate
> a translucent ball effect. I can enter coordinates by copying the output
> and paste it into the command line to automatically place n dots. ;-)

With Maple you can do it in a jiffy. Here's some code and the result:

> with(plots):
> with(stats):
> L1:=[stats[random, normald](1000)]: #1000 points with normal distribution
> L2:=[stats[random, normald](1000)]: #1000 more with normal distribution
>
> L:=[];
> for n from 1 to 1000 do
> L:=[op(L),[L1[n],L2[n]]];
> od:
> plot(L, style=point);

#result:

http://misc.virtualcomposer2000.com/Normal2D.gif

Now generalize to 3D.

> Thanks!
> Rich

--
Ioannis --- "There's _always_ a mistake, somewhere"

Date Subject Author
2/27/09 Rich Grise
2/27/09 RGVickson@shaw.ca
2/27/09 matt271829-news@yahoo.co.uk
2/27/09 swp
2/27/09 Ioannis
2/28/09 Mike Williams
2/28/09 RGVickson@shaw.ca
2/28/09 Kevin Stone