There are lots - It's a fairly simple and common parser-writing exercise so lots of people have had a go and published some code. See e.g.:
The likely issue will be the range of mathematical functions available. You can expect the standard ones, but may need to customise / add your own for the more unusual functions (cosh perhaps?)
Another option is to embed a language interpreter, e.g. Groovy to do the calculations. This is a bit more heavyweight and means that you will need to be much more conscious of security risks (e.g. if the code might get run on a server) but could make sense if you have a more general need for scripting.