Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!nbires!hao!noao!arizona!megaron!johnk From: johnk@megaron.UUCP Newsgroups: sci.math Subject: Algorithm Description Message-ID: <1266@megaron.UUCP> Date: Thu, 30-Oct-86 11:28:56 EST Article-I.D.: megaron.1266 Posted: Thu Oct 30 11:28:56 1986 Date-Received: Fri, 31-Oct-86 20:00:38 EST References: <146@helm.UUCP> <9700056@uiucdcsb> Organization: Dept of CS, U of Arizona, Tucson Lines: 32 I'm always amazed at the manner in which mathematicians describe algorithms. In a recent discussion on the generation of variates from a normal distribution, one of the most interesting presentations of the Box-Muller-Marsaglia algorithm was the following: V1 = 2*RND - 1 <--------+ V2 = 2*RND - 1 | S = V1*V1 + V2*V2 | IF S >= 1 THEN GOTO ----+ X1 = V1 * SQRT (-2 * LOG(S) / S) X2 = V2 * SQRT (-2 * LOG(S) / S) While this is a clever improvement on the ghastly "step 1", "step 2", "go to step i" style, why not simply repeat { v1 = 2*rand() - 1 v2 = 2*rand() - 1 s = v1^2 + v2^2 } until ( s < 1 ) x1 = v1 * sqrt(-2 * ln(s) / s) x2 = v2 * sqrt(-2 * ln(s) / s) Admittedly, this algorithm is trivial; here the manner of presentation makes little difference. I think the computer scientist most mathematicians know of is Knuth, and by presenting the algorithms of his _The_Art_of_Computer_Programming_ in the numbered step form, he legitimized a style which should, in our enlightened age, be obsolete. -- John Kececioglu / arizona!johnk "Chess, like love, like music, has the power to make men happy." -- S. Tarrasch