Algorithm to reduce expressions to canonical form

554 Views Asked by At

I'm writing a small computer algebra system that only knows rational numbers and all expressions that you can get from them by using basic arithmetic operations and powers. So the expressions are binary trees where inner nodes are operators ($+-\cdot \text{ / } \text{^}$) and leaves are rational numbers. So examples would be:

$$1+\sqrt{8}\;,\;(\sqrt{2}^{\sqrt{2}})^\sqrt{2}\;,\;\frac{4+\sqrt{12}}{2+\sqrt{3}}\;,\;\frac{5+\sqrt{2}+\sqrt{8}}{1+\sqrt{2}}$$

Now actually these are only 2 different numbers, each one in two different representations. I want my program to be able to find out if 2 expressions represent the same number or not, so I thought there could be kind of canonical form for those numbers, but I could not find any so far.

Is there such a canonical form and such an algorithm that decides if two expressions represent the same number?