3 ms·
It's perhaps true that if you're doing arithmetic and calculations above the elementary level it's a sign that there's something wrong. But if you observe and
by RiderOfGiraffes 16y ago
It's perhaps true that if you're doing arithmetic and calculations above the elementary level it's a sign that there's something wrong. But if you observe and prove that two operations commute and that doing them the other way round allows various advantages such as check-pointing or extraction of common sub-expression computation, it's slightly less clear.
An anecdote. I once noticed in a web programming context that someone was doing the same calculations over and over. The way the code was organised made it necessary, results couldn't be cached, nor could they be precomputed.
I showed that a sub-class of the operations were commutative (that took several pages, and then a 2 day meeting with the chief designer) which allowed some of the loop/function-call orderings to be reversed. Compute time went down by a factor of 100, and scalability was achieved.
The problem reminded me of some stuff I'd done in ring theory classes, and had something in common with the idea of groups acting on a topological space. The math wasn't actually directly useful - it just brought it all into focus and gave me a way to think.