Model-based Reinforcement Learning of Nonlinear Dynamical Systems