Live data from Hacker News

1.5 is the midpoint between 0 and infinity in Ruby

blog.peterzhu.ca

51–60 of 125 posts

Re: 1.5 is the midpoint between 0 and infinity in Ruby

#51
post #29

In surreal numbers [1], the midpoint between 0 and infinity would be the simplest number greater than 0, which is { 0 | } = 1 [1] https://en.wikipedia.org/wiki/Surreal_number

That's not right. 1 is different to half the sum of 0 and infinity. Another way to look at it is that infinity minus one is larger than one minus zero (which can be easily proven using the basic definitions used to define the surreals). Moreover, what is at the right side of {0|} is not infinity, but the empty set.

Re: 1.5 is the midpoint between 0 and infinity in Ruby

#52
post #29

In surreal numbers [1], the midpoint between 0 and infinity would be the simplest number greater than 0, which is { 0 | } = 1 [1] https://en.wikipedia.org/wiki/Surreal_number

TIL: apart from infinity (number, larger than any real number in absolute value) there are infinitesimal (number, less than any real number in absolute value and not a zero). Edit: also, those infinitesimals were the subject of political and religious controversies in 17th century Europe, including a ban on infinitesimals issued by clerics in Rome in 1632.

Infinitesimals and infinities are nice if you're doing some sort of bucketing logic.

    tiny = infinitesimal
    huge = infinity
    N = number to be bucketed

    tiny  bucket 1
    10  bucket 2
    ...
    X  last bucket

This removes edge cases you need to test for if you're trying to bucket positive values. This may not be something you've had to do, but I've had reason to want this before on a few occasions.

Re: 1.5 is the midpoint between 0 and infinity in Ruby

#54
post #43
post #29

In surreal numbers [1], the midpoint between 0 and infinity would be the simplest number greater than 0, which is { 0 | } = 1 [1] https://en.wikipedia.org/wiki/Surreal_number

Some other senses in which 1 can be thought of as the "midpoint" between 0 and ∞ come from the many common ways to invertibly map an interval onto (0, ∞), in which the midpoint of that interval maps onto 1. For example: • tan maps (0, π/2) onto (0, ∞), and tan(π/4) = 1. • f(x) = x/(1 - x) maps (0, 1) onto (0, ∞), and f(1/2) = 1. • exp is an isomorphism from the reals under addition to the positive reals under multipl…

I have a question

If this was true:

tan maps (0, π/2) onto (0, ∞), and tan(π/4) = 1

Wouldnt it imply that

tan(π/8) would be halfway between 0 and 1 ie .5?

By my calculations it is 0.414 or √2 - 1

ALso with:

• f(x) = x/(1 - x) maps (0, 1) onto (0, ∞), and f(1/2) = 1.

wouldnt this mean that f(0.25) is supposed to be half way between 0 and 1 or .5. However f(0.25) = 0.25/0.75 = 1/3

Re: 1.5 is the midpoint between 0 and infinity in Ruby

#55

Clearly we'll need to some work in TruffleRuby to be fully compatible. I really hope nobody's code depends on this. Infinity 8.988465674311579e+307 4.4942328371557893e+307 2.2471164185778946e+307 1.1235582092889473e+307 5.6177910464447366e+306 ... 32767.999999999996 16383.999999999998 8191.999999999999 4095.9999999999995 2047.9999999999998 1023.9999999999999 511.99999999999994 255.99999999999997 127.99999999999999 63…

I'm left wondering if this is real behavior, or you're doing a Douglas Adams joke...

Re: 1.5 is the midpoint between 0 and infinity in Ruby

#56
post #54
post #43

Earlier quoted context omitted.

Some other senses in which 1 can be thought of as the "midpoint" between 0 and ∞ come from the many common ways to invertibly map an interval onto (0, ∞), in which the midpoint of that interval maps onto 1. For example: • tan maps (0, π/2) onto (0, ∞), and tan(π/4) = 1. • f(x) = x/(1 - x) maps (0, 1) onto (0, ∞), and f(1/2) = 1. • exp is an isomorphism from the reals under addition to the positive reals under multipl…

I have a question If this was true: tan maps (0, π/2) onto (0, ∞), and tan(π/4) = 1 Wouldnt it imply that tan(π/8) would be halfway between 0 and 1 ie .5? By my calculations it is 0.414 or √2 - 1 ALso with: • f(x) = x/(1 - x) maps (0, 1) onto (0, ∞), and f(1/2) = 1. wouldnt this mean that f(0.25) is supposed to be half way between 0 and 1 or .5. However f(0.25) = 0.25/0.75 = 1/3

It would only imply that if the tangent was a linear function of the angle, but it is not.

Re: 1.5 is the midpoint between 0 and infinity in Ruby

#57

Isn't it -1/12 actually?

I was trying to remember the situation where in physics, under certain conditions, a proof that shows infinity can be represented numerically as -1/12 (it was some obscure fraction yet after seeing it, I think this was the value).

I couldn't for the life of me remember the set of conditions and proof that shows this but it was interesting when reading through it a few years ago.

Re: 1.5 is the midpoint between 0 and infinity in Ruby

#59

This all makes sense. It seems like there would be some special edge cases around the finite/NaN boundary that would be rarely exercised. I wonder if/how those are handled.

From Python:

    >>> import numpy as np
    >>> 1 + np.Inf
    inf
    >>> (0 + np.Inf)/2
    inf
    >>>
Infinity is not a number it is a concept[1] My math teacher used to say think of infinity like a impossibly large number. An impossibly large number divided by two is still an impossibly large number

[1] http://mathforum.org/dr.math/faq/faq.large.numbers.html

Re: 1.5 is the midpoint between 0 and infinity in Ruby

#60
post #54
post #43

Earlier quoted context omitted.

Some other senses in which 1 can be thought of as the "midpoint" between 0 and ∞ come from the many common ways to invertibly map an interval onto (0, ∞), in which the midpoint of that interval maps onto 1. For example: • tan maps (0, π/2) onto (0, ∞), and tan(π/4) = 1. • f(x) = x/(1 - x) maps (0, 1) onto (0, ∞), and f(1/2) = 1. • exp is an isomorphism from the reals under addition to the positive reals under multipl…

I have a question If this was true: tan maps (0, π/2) onto (0, ∞), and tan(π/4) = 1 Wouldnt it imply that tan(π/8) would be halfway between 0 and 1 ie .5? By my calculations it is 0.414 or √2 - 1 ALso with: • f(x) = x/(1 - x) maps (0, 1) onto (0, ∞), and f(1/2) = 1. wouldnt this mean that f(0.25) is supposed to be half way between 0 and 1 or .5. However f(0.25) = 0.25/0.75 = 1/3

This does not imply that tan(pi/8) is 0.5. There’s some overloaded language here that I’d like to unpack:

The original issue at hand is to talk sensibly about “half way” between 0 and infinity. But in the standard way we think about distance between numbers, there’s obviously no way to do that — you can’t add and subtract real numbers to infinity!

So, implicitly what’s happening here is that by talking about a map between a finite interval and (0,inf), we are equipping (0,inf) with a new, special definition of distance between numbers. This is called a metric.

Usually, when we talk about the distance between x and y, we mean `d(x,y) = |x-y|` — this is called the Euclidean metric (in 1 dimension).

Here, we’ve introduced a new metric on (0,inf): `d2(x,y) = |tan^-1(x) - tan^-1(y)|/(pi/8)`

The half way point between 0 and 1 under the Euclidean metric is 0.5. The half way point between 0 and 1 under our fancy new metric d2 is ~0.414.

TL;DR: You can generalize the notion of “distance between two numbers”, using distance functions called metrics. Under the typical metric, the half way point between 0 and 1 is 0.5. Under our cool new infinite-tan metric, the half way point between 0 and 1 is ~0.414.

Post reply on HN