For L equal to the unilateral or bilateral shift on a weighted sequence space, we characterize, in terms of f and the weight function, those f holomorphic on the spectrum of L for which f(L) is a chaotic operator. For B equal to d/dx, the generator of left translation, on weighted L^p spaces on [0, \infty) or \mathbb{R}, we similarly characterize those polynomials Q for which the differential operator Q(B) generates a chaotic semigroup.