Hi Zak,
When you are using MathObjects, doesn't already do that? Admittedly, I haven't tested this :), but that's what is claimed for the _reduce method here:
http://webwork.maa.org/viewvc/system/trunk/pg/lib/Parser/BOP/power.pm?view=markup
Jason
WeBWorK Main Forum
parser reduction rules
This forum has a limit to the number of forum postings you can make in a given time period - this is currently set at 10 posting(s) in 1 day