general mathematical function