Exact and optimal quadratization of nonlinear finite-dimensional non-autonomous dynamical systems