math functions and classes for the browser and node.js