Let me start with an analogy:
In test driven software development, you craft a couple of tests that describe what your program is supposed to do. When introducing a new feature, you start with a test that describes it, and then implement the feature that's supposed to satisfy that test, while not breaking any other existing tests.
Now when writing a paper in LaTeX that involves mathematical formulas, I find myself in the following situation: I might write an early draft based on some calculations that I did on paper or in a Computer Algebra System (CAS). Later, I want to modify some equations, e.g. generalize them. To ensure other equations derived from the modified ones are still correct -- or to modify them, too -- I need to look up my initial calculations, e.g. find the sheet(s) of paper on which I did them, or the CAS file containing them, or, if I can't find them anymore (as it happens), do my entire calculations again.
Now one way to tackle this might just be tidying up my notes ;-) but ideally, I'd like to have automatic tests that ensure e.g. equation (14) follows from (10) and (12) with
a set to
b^2, so that if I modify (10), I'm notified that (14) breaks. That way, I would know that I'd also need to modify (14) (or something else it's based on), and when I think I've fixed it, rerun my tests.
Is there an easy way to achieve this? Do people write entire papers in a CAS like Maple or Mathematica (which I've personally never used much) to allow for such a workflow? Personally, I'm writing my papers with LyX, so I'd prefer a solution that integrates with that. For calculations, I'm using paper and pencil, and SymPy for the occasional matrix multiplication, but currently, my SymPy files end up rather chaotic with time, which is one of the reasons why I'm looking for a better workflow.