Believe it or not there are open source computer algebra systems! Two that I'm familiar with are Maxima and PARI-GP (sorry, don't have a link at the moment). Maxima is general purpose, while PARI-GP is mostly about number theory.
Maxima's history is interesting. It is based on the source code (Lisp!) of the Macsyma system developed at MIT circa 1970-1980. Mathematica is essentially a rewrite of Macsyma with very slightly different syntax. You know what they say about imitation.