I've added some new basic algebraic simplificaitons to the juce expression class as part of my sparse optimized matrix solver, so I thought I'd share the latest version. It only handles simplifications of + - * / , and it's no where near a full CAS, but it is useful to trim off the fat off expressions before generating code to compile (which is what my matrix solver does) or for evaluating them (eg if you support user entered expressions in your program). I've also added a few different output options, so you can auto generate infix / prefix code from them.

a+a*b --> a*(1+b) a/a --> 1 a+a --> 2*a (a+b)*c + (a+b)*d --> (a+b)*(c+d) a/b/c --> a/(b*c)

https://dl.dropboxusercontent.com/u/14219031/Juce/BasicExpressionSimplification.zip