From: Colin Bartlett Date: 2010-12-25T07:40:39+09:00 Subject: Re: Numeric comparison with nil - Math masochists only!! --0023547c8bf144ffc304982f9855 Content-Type: text/plain; charset=ISO-8859-1 On Fri, Dec 24, 2010 at 3:45 AM, serialhex wrote: > Alright, i'm trying to do three things at once, and I'm almost succeeding. > The first thing is learn Ruby, the second thing is learn Surreal Numbers, > and the third is to make a Ruby class for Surreal numbers. :P My problem > is this: part of the definition of a surreal number is pretty much a > comparison with nil. So how would one go about this? Should I write a <=> > and mixin Comparable? What else should I include to make this easier?? Any > help & suggestions are most welcome!! > A possibly unhelpful suggestion about nil <=> y and y <=> nil: does the nil for Surreal *have* to be the Ruby nil of NilClass? I think it could be (as you say, write Nil#<=> and mixin Comparable) and I guess that it's unlikely that a SurrealNumbers class would be used with anything else?? (But you can never be sure: another of my lecturers (see Semi-OT below) was Ian Stewart, and in one of his 1990s (sort of) popular books on modern mathematics he says non-standard arithmetic has been used to devise better ways of representing images using pixels (or something like that): basically work out the theory using "finite" "infinite" integers, then use the results to make a practical algorithm by changing a "finite" "infinite" integer to a large finite integer.) So if you wanted to avoid possible clashes with other code which expects (nil <=> other) to raise an exception you could set up class Surreal::SurrealNil # define appropriate methods end Surreal::Nil = Surreal::SurrealNil.new Nil = Surreal::Nil # maybe You can do: class Surreal::SurrealNil < NilClass but then there isn't Surreal::SurrealNil.new, presumably because there isn't NilClass.new I'd be interested to see what you come up with, because periodically I try to really understand NonStandard Analysis, and the NonStandard Reals are a subset of the Surreals. *** Semi-OT: I followed up some links from your links, and found a name I recognized as the lecturer who gave my first (or at least one of my first) lectures in mathematics at the University of Warwick in October 1973, a one term course on the Foundations of Mathematics. (Basically set theory using Paul Halmos's Naive Set Theory.) I knew he became very interested in mathematical education some time after I'd graduated, but I didn't know that he was also interested in "intuitive" concepts of infinity. Following up links and trying to find out more about David O Tall's "super-real" numbers I found: http://www.jonhoyle.com/MAAseaway/Infinitesimals.html (section 3.2) A less ambitious but much more accessible approach to defining infinitesimals is one by David Tall from the University of Warwick. His motivation was to create a system which was more intuitive for students and to make Calculus concepts easier to grasp. The simplicity of his approach is very appealing, as it quickly gets to the use of infinitesimals without the large construction found *R's construction. ... http://www.warwick.ac.uk/staff/David.Tall/downloads.html http://www.warwick.ac.uk/staff/David.Tall/themes/limits-infinity.html and in particular this delightful conversation about infinity between David Tall and his seven year old son: http://www.warwick.ac.uk/staff/David.Tall/pdfs/dot2001l-childs-infinity.pdf --0023547c8bf144ffc304982f9855--