Why does InverseFunction[0 &]@0 return 33/10?
Asked Answered
A

1

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?

Ansilme answered 12/10, 2011 at 5:22 Comment(14)
7.0 refuses to evaluate this, btw.Auburta
InverseFunction[ i &]@i gives 33/10 for integer iNuno
@belisarius: It also works for rational numbers, but not strings, floats, or functions.Ansilme
@Mech Also works for irrationals ... (Pi, E, Sqrt@2 ...)Nuno
Try Trace[InverseFunction[6 &]@6, TraceInternal -> True] And search for 33/10 near the endNuno
@belisarius: According to the trace, it seems to be using a RNG (I presume seeded to make it deterministic).Ansilme
@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 RandomSampleNuno
@belisarius: When seeding with SeedRandom[0], RandomSample[Range[-50,50],1] produces {33} so I'm guessing that's where it comes from.Argol
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.Valentinavalentine
I think with all this data, perhaps @Mechsnail could write an answer him/herselfNuno
@Argol try SeedRandom[2];RandomInteger[{-50, 50}] :) That is the correct answer, for sureNuno
@belisarius: Somehow, I knew what the answer was going to be before I ran the code :-)Argol
@Argol 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 :)Nuno
@belisarius: Surprisingly enough, SeedRandom[0]; RandomChoice[Range[n]] gives 42 for any n in the range [42, 64]. Coincidence? I think not.Argol
C
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.

Caespitose answered 12/10, 2011 at 18:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.