There exist programs which can do algebra, but they are pretty complex. That is because all those mathematical formulas and when to apply them need to be programmed into the computer.
Also, it took me a minute to figure out what you wanted. On the lower-right side of your Format: box there is a superscript button: