Christoph mentioned Macaulay-2

  Reference Manual
  http://www.math.uiuc.edu/Macaulay2/Manual/0838.html

There is also the richer (though regrettably closed-source)

  MAGMA
  http://magma.maths.usyd.edu.au/magma/htmlhelp/MAGMA.html

as an example of what can be done when a programming language
_really_ tries to support algebra.

Hopefully we will start to see a more powerful treatment of
mathematics in general-purpose programming languages within
the next few years.  (Perl6?:)

Mitchell Charity