When I Trace
a rational number, I get this quite complicated output:
1/2 // Trace
{{1/2,1/2},1/2,1/2}
which under the hood looks like
{{HoldForm[1/2], HoldForm[1/2]}, HoldForm[1/2], HoldForm[1/2]}
At the same time, 1/2
is represented as Rational
:
1/2 // FullForm
Rational[1, 2]
But if we do:
Rational[1, 2] // Trace
we get very simple output, which would be expected:
{Rational[1,2],1/2}
with underlying output being
{HoldForm[Rational[1, 2]], HoldForm[1/2]}
So, the question is: why MMA does so many steps when evaluating a rational number entered in a "pure" form and doesn't do it when Rational
is used explicitly?
Trace[1/2] // FullForm
already? $\endgroup$