Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!cmcl2!lanl!matthias@mpx1.lampf.lanl.gov From: matthias@mpx1.lampf.lanl.gov (Matthias, Bjorn E.) Newsgroups: comp.graphics Subject: random points on surface of sphere Keywords: random, sphere Message-ID: <50234@lanl.gov> Date: 4 May 90 02:20:51 GMT Sender: news@lanl.gov Reply-To: matthias@mpx1.lampf.lanl.gov Followup-To: comp.graphics Organization: LAMPF Data Analysis Center, Los Alamos, New Mexico Lines: 51 In a recent posting of mine, I was too hasty in claiming that random walk sampling of a distribution in usually slower than a direct inversion when the latter is possible. Sorry about that! A followup posting from Jim Roth presented what I think is a very elegant random walk of sorts on the surface of a sphere. He says: >In this case, it is considerably faster to do a random walk on the sphere, .. (his code is available in his posting) .. I timed his random walk and checked the first and second moments of the PHI and THETA distributions and thought I should post the results together with those of the other two methods: rejection method cpu = 31620 msec failures = 476793 ; fraction = 47.68 % successes = 523207 ; fraction = 52.32 % diagnostics on distribution: number of points = 523207 first moment of phi = 3.1417506 second moment of phi = 13.1581593 first moment of theta = 1.5707290 second moment of theta = 2.9352241 direct method cpu = 26050 msec diagnostics on distribution: number of points = 523207 first moment of phi = 3.1412365 second moment of phi = 13.1574106 first moment of theta = 1.5701435 second moment of theta = 2.9331174 random walk method cpu = 17780 msec diagnostics on distribution: number of points = 523207 first moment of phi = 3.1411185 second moment of phi = 13.1555815 first moment of theta = 1.5704634 second moment of theta = 2.9331996 Clearly, the random walk is the superior performer here. Thanks, Jim! Regards, Bjorn --- Bjorn E. Matthias MATTHIAS@LAMPF (BITNET) matthias@mpx0.lampf.lanl.gov or matthias@mpx1.lampf.lanl.gov (internet)