phi and theta functions