Thanks for all the tips. I think Math::Algebra::Symbols was what I was looking for, but by the time I found it I had already written the script to just run the equations through mathomatic to simplify them.
Comment on Re^2: minimizing simple linear equations