some initial code and tests using Apache Math lib