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?
Trace[InverseFunction[6 &]@6, TraceInternal -> True]
And search for 33/10 near the end – NunoSeedRandom[0]
,RandomSample[Range[-50,50],1]
produces{33}
so I'm guessing that's where it comes from. – ArgolTraceInternal->True
, you see, among the huge output, code likeSystem`InstanceDump`freepts[{System`TRootsDump`X$2453}, System`InstanceDump`dds$2454, 1]
. If you further trace theTrace[System`InstanceDump`freepts[{x}, {{x -> Reals}}, 1]]
, you seeSystem`InstanceDump`RandomSampleI[ Range[-(System`InstanceDump`$intsize/2), System`InstanceDump`$intsize/ 2], 1]/Sqrt[System`InstanceDump`$intsize]
. Theintsize
variable is actually set to100
, which, combined with observations of belisarius and Heike, leads to the puzzling output. – ValentinavalentineSeedRandom[2];RandomInteger[{-50, 50}]
:) That is the correct answer, for sure – Nuno2
instead of0
. I am pretty sure that that will guarantee better integration results and a deeper understanding of the Universe :) – NunoSeedRandom[0]; RandomChoice[Range[n]]
gives42
for anyn
in the range[42, 64]
. Coincidence? I think not. – Argol