MathGroup Archive 2013

[Date Index] [Thread Index] [Author Index]

Search the Archive

Mathematica and trivial math problems that school children can solve.

  • To: mathgroup at
  • Subject: [mg129818] Mathematica and trivial math problems that school children can solve.
  • From: Andrzej Kozlowski <akozlowski at>
  • Date: Sat, 16 Feb 2013 01:09:24 -0500 (EST)
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:
  • Delivered-to:

Recently I came across an article in a mathematics and physics journal 
aimed at high school students. The main reason why it attracted my 
attention was that its theme was computer algebra and, in particular, 
Mathematica. The moral of the story was quite sensible: these programs 
can do wonderful things but don't expect them to be smart, in the human 
sense, anyway. The example that was given was apparently taken from the 
Internet as a notorious "breaker" of computer CAS programs. This was the 
illustration in Mathematica:

Reduce[(10 x + 2)^2009 == (2 x + 4)^2009, x, Reals]

Apparently all CAS programs used to get stuck on this, back in 2009, 
that is. Well, it is now 2013 and computers are much faster so actually 
we get:

Timing[Reduce[(10*x + 2)^2009 == (2*x + 4)^2009, x, Reals]]
{6.51, x == 1/4}

So, to produce an illustration suitable for the present day we add an 
extra 0 inside the exponent:

Reduce[(10 x + 2)^20009 == (2 x + 4)^20009, x, Reals]

Mathematica spends far too long to do this than anyone would care to 
wait, while a reasonably smart school high-schooler can do it in no time 
at all. So should we be disappointed with Mathematica's performance 
here? Well, the first thing I always want to say when someone comes up 
with examples of this kind is: don't try to judge CAS programs by the 
sort of things you can do very well yourself. Chances are they will come 
up short (one reason I will explain below). The right way to judge CAS 
program (and perhaps all computer programs) is by testing them on things 
that we either can't do well or can't do at all, like solving general a 
polynomial equations of some large degree.

Of course we can easily see the reason for the problem above. When 
Mathematica is given a polynomial equation to solve, the first thing it 
does is to expand the polynomials. In the overwhelming majority of cases 
this will be the right thing to do and only in some very rare ones, like 
the above, there is a better approach.  Does it mean that Mathematica 
does not "know" the other approach and that it could not be programmed 
to use it? Of course not. In fact, by slightly changing the problem 
above you can make Mathematica return the answer almost immediately:

Reduce[(10 x + 2)^(20009 Pi) == (2 x + 4)^(20009 Pi), x,Reals] // Timing

{0.301534, x == 1/4}

All we did above  was make the power non-rational, which prevented 
Mathematica from using the expansion method. Obviously, it would be 
quite easy to change Reduce, so that it would first look for such 
special cases before turning to the standard expansion-based algorithm. 
But would this sort of thing be worth the time spent by the programmer, 
even if in this case it is very short? Obviously there are lots of other 
special cases, corresponding to various situations where for some reason 
standard computer algebra algorithms do not work well or work slowly, 
but which human beings have no difficulty with. Should they all be 
implemented by "heuristic" techniques?

Of course this sort of thing (using heuristics when there are not good 
algorithms) is done quite often. But it is reasonable to do so only if 
there is a fairly high chance of this sort of situation arising in the 
course of some naturally occurring computation that was not designed to 
show that there a human being can beat Mathematica at certain things 
(actually it is still very easy to show that and it will surely remain 
so for many years to come). It is not worth spending time and effort 
only to deprive people certain people of the satisfaction of posting 
trivial examples of what they call "bugs" in Mathematica. Computers are 
not intended to replace us (not yet, anyway) but to help us.

Andrzej Kozlowski

  • Prev by Date: barchart
  • Next by Date: Speak Command in Ver 9
  • Previous by thread: barchart
  • Next by thread: Re: Mathematica and trivial math problems that school children can solve.