Dynamical equations for optimal nonlinear filtering