Mathematica makes me want to cry: standard radical form edition

Here is a thing that makes me want to cry: every high school student at some point learns about putting things in something called “standard radical form.”  For example, I learned to simplify \frac{2 + \sqrt{3}}{1 - \sqrt{3}} by multiplying the top and bottom by the conjugate of the denominator, yielding

\displaystyle \frac{2 + \sqrt{3}}{1 - \sqrt{3}} = \frac{(2 + \sqrt{3})(1 + \sqrt{3})}{(1 - \sqrt{3})(1 + \sqrt{3})} = - \frac{5 + 3 \sqrt{3}}{2}.

This is maybe a stupid thing to teach high school students, but it is at least related to a very non-stupid thing, which is that when you take an algebraic extension of a field, like say \mathbb{Q}(\sqrt{5}), the resulting object is a vector space over the base field with dimension given by the degree of the adjoined element and an explicit basis given by powers of that element.  (This is not the only possible choice for what the non-stupid thing is.)  What this means is that if I write down any expression that is a result of additions, subtractions, multiplications and divisions involving only rational numbers and (say) the square root of 5, there is an honest canonical way to write this, namely as a + b \sqrt{5} for some rational numbers a and b.  Thus testing whether two such expressions are equal is theoretically trivial.

All of this build-up is to an uninteresting conclusion, namely, that Mathematica doesn’t know any of the above facts.  In particular, none of its built-in simplification tools take advantage of these simple canonical forms.  The result is that it is quite a lot of work to do almost anything that requires one to compare numbers in such field extensions, and so for example if you ask Mathematica for the positions of (1 + \sqrt{5})/2 in a list that contains both (1 + \sqrt{5})/2 and 2/(\sqrt{5} - 1), it will only tell you about instances of the first element.  Alas.

This entry was posted in Math, Mathematica and tagged , , . Bookmark the permalink.

2 Responses to Mathematica makes me want to cry: standard radical form edition

  1. Joseph Nebus says:

    I am surprised. I’d have thought putting things into a standard radical form either the default behavior or something that could be easily activated in Mathematica. I’d have thought it was what FullSimplify was for. (Admitting here it’s been years since I’ve needed Mathematica for something.)

  2. JBL says:

    Yes, I agree. Apparently, the explanation is that the Simplify family (including FullSimplify) just doesn’t work that way at all; instead, they seem to come with an internal measure of complexity of expressions, and they apply simplification rules that decrease the complexity, and that’s it — they don’t actually try to understand the meaning of the expressions they are simplifying. I guess there are some good reasons for doing this (rather than having a zillion ad hoc processes for different kinds of expressions), but sometimes what you really want is just one good ad hoc process ….

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s