Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!seismo!columbia!rutgers!clyde!cuae2!ihnp4!inuxc!pur-ee!j.cc.purdue.edu!k.cc.purdue.edu!l.cc.purdue.edu!roz From: roz@l.cc.purdue.edu (Vu Qui Hao-Nhien) Newsgroups: sci.math Subject: Re: Algorithm Description Message-ID: <460@l.cc.purdue.edu> Date: Tue, 18-Nov-86 16:11:29 EST Article-I.D.: l.460 Posted: Tue Nov 18 16:11:29 1986 Date-Received: Wed, 19-Nov-86 06:19:31 EST References: <146@helm.UUCP> <9700056@uiucdcsb> <1266@megaron.UUCP> Reply-To: roz@l.cc.purdue.edu.UUCP (Vu Qui Hao-Nhien) Distribution: world Organization: Purdue U. Dept. of Mathematics Lines: 42 Keywords: "repeat" Expiration: In article <1266@megaron.UUCP> johnk@megaron.UUCP writes: Essentialy, that 'the ghastly "step 1", "step 2", "go to >step i" style' is, well, ghastly. And then gave the alternative for a goto: > > 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) Well, goto looks a whole lot more formal. I don't know why. It just feels that way. My own style is instead of using brackets {}, I'd do step 1. v1 = .... v2 = .... step 2. if s >= 1, repeat Big step 1. step 3. x1 = .... x2 = .... Brackets, especially when written your way, is intimidating (eg. Why is there a right bracket at the beginning of a line ? ) >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. Sad but true. Most mathematicians present algorithms the Knuth way, mostly because they learn basic mathematical algorithms from Knuth's book. =========== Hao-Nhien Q. Vu (pur-ee!stat-l!vu) (vu@l.cc.purdue.edu) [That's stat-"ell", not stat-"one"] -- Hao-Nhien Q. Vu (pur-ee!stat-l!vu) (vu@l.cc.purdue.edu) [That's stat-"ell", not stat-"one"]