validate mathematical formula