At the moment I am doing some work which involves many lengthy derivations. Typically these derivations involve multiple integrals of matrix functions. (If you’ve ever had to do perturbation theory in quantum field theory you will have done similar calculations.) The problem is that if I make even a tiny mistake, e.g., a minus-sign error, then this snowballs into a big BIG mess. And the final answer *needs* to be correct because it’s to be used in a numerical procedure; the method goes crazy otherwise! (These calculations are for an application of the variational principle over cMPS to some example quantum field theories; you can look at a summarised example here where I’ve written out all the equations required to reproduce the numerics of this paper.)

I’ve given up on writing these calculations on paper because I keep having to tear it up and startÂ again. (This is very frustrating if you’ve just written 10 pages of derivations and then you find a sign error on page 2; how do you propagate the corrections through the following 8 pages without ending up with an unreadable mess?)

So I’ve adopted an “algorithm” which appears to be fairly robust: I write all the derivations in latex. Then I copy and paste the current equation and make one, *and only one*, substitution/evaluation/rearrangement, and then repeat. This procedure quickly produces very long latex files. But I’ve noticed that when I make a mistake it is fairly easy to propagate the correction through the remainder of the notes. Also, I seem to make fewer mistakes. It may seem like a lot of work, but I think it’s better than tearing up paper!

What I dream of now is some kind of “automated derivation error correction” for my procedure. I don’t mean anything sophisticated, just some protocol where a derivational error can be detected and corrected many steps later without having to correct all the intervening lines. Perhaps some kind repetition encoding…? Of course one would need the discipline to actually apply it… ðŸ˜‰