Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[mg14697] creating distributions

1 view
Skip to first unread message

Naum Phleger

unread,
Nov 9, 1998, 3:00:00 AM11/9/98
to math...@smc.vnet.net
I want to distribute vectors for a given vector field evenly over
the surface of a sphere. The easiest way that I have come up with is
to generate a random list of {theta,fi} pairs. This makes the field
too dense at the north and south poles. I would like to use a cosine
distribution to be used in my random number generator so that I get a
more uniform distribution. Here is my code now, and what I would like
it to look more like.

density is the total number of vectors

NOW:
pointlist=Table[{Random[Real,{ -pi/2 , pi/2 }], Random[Real,{ -pi ,
pi }]},{density,i}]

DESIRED
pointlist=Table[{Random[CosDistribution,{ -pi/2 , pi/2 }],
Random[Real,{ -pi , pi }]},{density,i}]

-NAUM


Jurgen Tischer

unread,
Nov 12, 1998, 3:00:00 AM11/12/98
to math...@smc.vnet.net
Hi Naum,
try
pointlist=Table[{ArcSin[Random[Real,{-1,1}],
Random[Real,{-pi,pi}]},{density}]

Jurgen

0 new messages