I'm handling some mixed-numeric-analytic expressions, and I feel I'm missing some subtleties of how Mathematica handles simplification of such expressions.
In particular, I was initially puzzled by the fact that
0. + a
(with a
undefined) will not simplify to a
, but of course this forgets that 0.
and 0
are not the same, and that if, say, one later on sets a=1
then 0+a
will return an exact result but 0.+a
will return a float.
However, if one takes this a bit further, to the expressions
0. + 1. a
and
1. (0. + a)
then they will still be returned intact. By the criterion above, simplifying them to 1. a
and 0.+a
would be functionally equivalent, so I feel I'm missing something. Does Plus[0.,expr]
only simplify further if expr
is a numeric expression? Does Mathematica decide not to delve into the depths of expr
, potentially taking some overhead in complicated expressions, to save some complicated analysis? Or are the different expressions not actually equivalent?
Or am I just over-reading into this?
Comments
Post a Comment