6

In Mathematica 8.0.1.0 on 32-bit Linux, the expression

InverseFunction[0 &]@0

returns 33/10. (The same occurs for other integer and rational values; I'm using 0 as an example.)

According to the documentation for InverseFunction:

As discussed in Functions That Do Not Have Unique Values, many mathematical functions do not have unique inverses. In such cases, InverseFunction[f] can represent only one of the possible inverses for f.

As a constant function 0& will return 0 regardless of its input, it has infinitely many inverse functions (each of which is defined only at 0). So as defined, this answer is within the specification.

The mystery is, why does it give 33/10 rather than any other value?

Dr. belisarius
  • 60,527
  • 15
  • 115
  • 190
Mechanical snail
  • 29,755
  • 14
  • 88
  • 113
  • 1
    7.0 refuses to evaluate this, btw. – kennytm Oct 12 '11 at 05:27
  • InverseFunction[ i &]@i gives 33/10 for integer i – Dr. belisarius Oct 12 '11 at 05:40
  • @belisarius: It also works for rational numbers, but not strings, floats, or functions. – Mechanical snail Oct 12 '11 at 05:42
  • 1
    @Mech Also works for irrationals ... (Pi, E, Sqrt@2 ...) – Dr. belisarius Oct 12 '11 at 05:47
  • 4
    Try `Trace[InverseFunction[6 &]@6, TraceInternal -> True]` And search for 33/10 near the end – Dr. belisarius Oct 12 '11 at 06:01
  • @belisarius: According to the trace, it seems to be using a RNG (I presume seeded to make it deterministic). – Mechanical snail Oct 12 '11 at 06:07
  • 1
    @Mech Seems like that. It is taking RandomSamples in {-50,50}, but I am not sure where the first {33} is coming from. Perhaps it is just a result from one RandomSample – Dr. belisarius Oct 12 '11 at 06:11
  • 3
    @belisarius: When seeding with `SeedRandom[0]`, `RandomSample[Range[-50,50],1]` produces `{33}` so I'm guessing that's where it comes from. – Heike Oct 12 '11 at 08:16
  • 4
    When you trace the execution with the option `TraceInternal->True`, you see, among the huge output, code like ``System`InstanceDump`freepts[{System`TRootsDump`X$2453}, System`InstanceDump`dds$2454, 1] ``. If you further trace the ``Trace[System`InstanceDump`freepts[{x}, {{x -> Reals}}, 1]]``, you see ``System`InstanceDump`RandomSampleI[ Range[-(System`InstanceDump`$intsize/2), System`InstanceDump`$intsize/ 2], 1]/Sqrt[System`InstanceDump`$intsize]``. The `intsize` variable is actually set to `100`, which, combined with observations of belisarius and Heike, leads to the puzzling output. – Leonid Shifrin Oct 12 '11 at 10:32
  • I think with all this data, perhaps @Mechsnail could write an answer him/herself – Dr. belisarius Oct 12 '11 at 15:02
  • @Heike try `SeedRandom[2];RandomInteger[{-50, 50}]` :) That is the correct answer, for sure – Dr. belisarius Oct 13 '11 at 16:51
  • @belisarius: Somehow, I knew what the answer was going to be before I ran the code :-) – Heike Oct 13 '11 at 17:09
  • @Heike We should write a petition to WRI to modify the random seeder and use `2` instead of `0`. I am pretty sure that that will guarantee better integration results and a deeper understanding of the Universe :) – Dr. belisarius Oct 13 '11 at 17:21
  • 2
    @belisarius: Surprisingly enough, `SeedRandom[0]; RandomChoice[Range[n]]` gives `42` for any `n` in the range `[42, 64]`. Coincidence? I think not. – Heike Oct 13 '11 at 17:56

1 Answers1

3

That number appears in a number of instances. Take for instance:

FindInstance[x == x, x, Reals]

{{x->33/10}}

I've seen discussions of this number come up before. It's basically just some result of how Mathematica is implemented. You'll get this sometimes when you ask Mathematica to do something that boils down to "Pick a Random Real number". It doesn't have any real special meaning.

Searke
  • 779
  • 3
  • 3