first pass at derive_everything.m, figured out lots of stuff, still a couple questions.