AMPL is a programming language that lets you specify equation systems algebraically and seems close enough to your project to be well worth a look especially since The AMPL Book, coauthored by Robert Fourer, David M. Gay, and Brian W. Kernighan (yeah, that Brian Kernighan) is free to download and just about the best tech writing you will find anywhere. Wolfram alpha is a free web based algebraic equation solver site that could also give you good ideas. These are on the equation solving end of your question though Wolfram language is usually considered to be a functional programming language.