This paper presents a fairly general treatment of recursive infinite horizon forward looking optimizing systems on infinite dimensional spatial domains. It includes optimal control, an analysis of local stability of spatially flat optimal steady states and development of techniques to compute spatially heterogeneous optimal steady states. The paper also develops a concept of rational expectations equilibrium, a local stability analysis for spatially homogeneous rational expectations steady states, and computational techniques for spatially heterogeneous rational expectations steady states.