Same motivation as this q. Why doesn't Rationalize
work for 0.?
Interval[{0., 1.}] // Map[Rationalize, #, {2}] &
Interval[{-4.45015*10^-308,1}]
There's nothing wrong with 0. by itself:
{0., 1.} // Map[Rationalize]
{0, 1}
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communityI believe this has to do with the fact that intervals "grow" just a bit on evaluation with machine numbers to ensure that values at the endpoint will be included in the interval.
NestList[Interval @@ # &, Interval[{0., 1.}], 5] // InputForm
(*
{Interval[{-2.2250738585072014*^-308, 1.0000000000000002}],
Interval[{-4.450147717014403*^-308, 1.0000000000000004}],
Interval[{-6.675221575521604*^-308, 1.0000000000000007}],
Interval[{-8.900295434028806*^-308, 1.0000000000000009}],
Interval[{-1.1125369292536007*^-307, 1.000000000000001}],
Interval[{-1.3350443151043208*^-307, 1.0000000000000013}]}
*)
I'm only guessing at why it is designed this way. The docs give a pretty vague description.
"For approximate machine- or arbitrary-precision numbers x, Interval[x] yields an interval reflecting the uncertainty in x."
Edit:
Just to make it a little more interesting, this is what it appears to be doing to the endpoints.
NestList[# + {$MinMachineNumber, $MachineEpsilon} &, {0., 1.}, 5] // InputForm
(*
{{0., 1.},
{2.2250738585072014*^-308, 1.0000000000000002},
{4.450147717014403*^-308, 1.0000000000000004},
{6.675221575521604*^-308, 1.0000000000000007},
{8.900295434028806*^-308, 1.0000000000000009},
{1.1125369292536007*^-307, 1.000000000000001}}
*)
I suspect that in general the step is $MachineEpsilon
but zero is a special case as it often is in Mathematica.
Rationalize[]
if seen fit. $\endgroup$Map[Rationalize[#, 0] &, Interval[{0., 1.}], {2}]
$\endgroup$Interval[{0., 1.}] // Map[Rationalize[#, 0.0000000000000001] &, #, {2}] &
$\endgroup$Interval
specific. $\endgroup$Interval[{0., 1.}]/2 // Rationalize
for demonstrating how bad my floating-point intuition is. $\endgroup$