Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > Numeric comparison with nil - Math masochists only!!

Reply
Thread Tools

Numeric comparison with nil - Math masochists only!!

 
 
serialhex
Guest
Posts: n/a
 
      12-24-2010
[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. 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/goo...rreal_numbers/
http://www.dm.unipi.it/~fornasiero/p...linearized.pdf

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

thanks again!

-hex

 
Reply With Quote
 
 
 
 
Colin Bartlett
Guest
Posts: n/a
 
      12-24-2010
[Note: parts of this message were removed to make it a legal post.]

On Fri, Dec 24, 2010 at 3:45 AM, serialhex <(E-Mail Removed)> 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. 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...downloads.html
http://www.warwick.ac.uk/staff/David...-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...s-infinity.pdf

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Math.random() and Math.round(Math.random()) and Math.floor(Math.random()*2) VK Javascript 15 05-02-2010 03:43 PM
OT: For all you Masochists out there ... TheITGirl MCDST 2 07-30-2007 01:57 PM
OT: For all you Masochists out there ... TheITGirl MCSE 2 07-30-2007 01:57 PM
OT: For all you Masochists out there ... TheITGirl MCSA 2 07-30-2007 01:57 PM
Integer(nil) versus Float(nil) versus String(nil) Christoffer Sawicki Ruby 5 09-02-2006 06:28 PM



Advertisments