1. Devise an algorithm to generate uniformly distributed points on the surface of a sphere (i.e., so that no area has a higher expected concentration than any other of the same size). Positions can be referenced by latitude and longitude.
2. Say an event happens at 60 times per hour in a Poisson distribution (say customer arrivals in a store), so averaging also once per minute. Devise an algorithm to generate realistic arrival times for a one-hour period.
Note: Assume what's available is a uniformly distributed random real number generator on the interval (0,1).
A single uniform distribution on (0,1) can stand in for any number of uniform distributions on any intervals.
To make one interval on (0,1) stand in for two: look at their decimal representations and separate the digits in even positions from those in odd positions. 0.51205783... becomes 0.5258... and 0.1073...
Changing the endpoints of the interval by addition or multiplication is simple.
For part 1 lets make use of the fact that the sphere has the same surface area as the lateral surface of the circumscribed cylinder. https://en.wikipedia.org/wiki/Sphere#Surface_area
The net of this surface is a rectangle with width 2pi*r and height 2*r.
We can get Longitude with the interval E=(-180,180)
If x=(-1,1) then N=arcsin(x) is the Latitude
|
Posted by Jer
on 2021-06-21 09:19:58 |