Numeric comparison with nil - Math masochists only!!

Discussion in 'Ruby' started by serialhex, Dec 24, 2010.

  1. serialhex

    serialhex Guest

    [Note: parts of this message were removed to make it a legal post.]

    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!!

    And for those of you who are interested and want more info on surreal
    numbers, here are some links...
    http://en.wikipedia.org/wiki/Surreal_number
    http://www.tondering.dk/claus/surreal.html
    http://scienceblogs.com/goodmath/goodmath/numbers/surreal_numbers/
    http://www.dm.unipi.it/~fornasiero/phd_thesis/thesis_fornasiero_linearized.pdf

    thats all of my links to surreal numbers... it kinda sucks that my biggest
    hurdle is at the very beggining!! :p

    thanks again!

    -hex
    serialhex, Dec 24, 2010
    #1
    1. Advertising

  2. [Note: parts of this message were removed to make it a legal post.]

    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
    Colin Bartlett, Dec 24, 2010
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Brian Candler

    puts nil generates "nil\n"

    Brian Candler, Nov 6, 2004, in forum: Ruby
    Replies:
    1
    Views:
    103
  2. John Carter
    Replies:
    64
    Views:
    622
    Klaus Stein
    May 19, 2005
  3. ako...

    a == nil or a.nil?

    ako..., Nov 22, 2005, in forum: Ruby
    Replies:
    6
    Views:
    134
    Douglas Livingstone
    Nov 23, 2005
  4. Christoffer Sawicki
    Replies:
    5
    Views:
    240
    Christoffer Sawicki
    Sep 2, 2006
  5. VK
    Replies:
    15
    Views:
    1,125
    Dr J R Stockton
    May 2, 2010
Loading...

Share This Page