I'm getting results that are sensitive to where I place parentheses with respect to operations that are associative1 (and should thus be insensitive to such placement). For example, if I define2
<< Units`; << PhysicalConstants`;
stellarDayTextbook = 1/(1/Day + 1/Convert[SiderealYear, Day])
and then calculate
1/stellarDayTextbook - 1/Day - 1/Convert[SiderealYear, Day]
I get precisely zero, as expected. But if I add parentheses
(1/stellarDayTextbook - 1/Day) - 1/Convert[SiderealYear, Day]
I get
-(3.03577*10^-17/Day)
What's causing this?
1. Remember, this isn't C, it's math: "subtraction" of $x$ is just the addition of $-x$. Check TreeForm
.
2. I realize this isn't the definition of a "stellar day", but merely a textbook approximation. The distinction is not material to the question.
-
with+-
. $\endgroup$Chop
on the result to get rid of the error. $\endgroup$