generalizing math function finder